Control Run-Time Checks - MATLAB & Simulink (original) (raw)

Main Content

Types of Run-Time Checks

The code generated for your MATLABĀ® functions includes the following run-time checks and external calls to MATLAB functions.

When to Disable Run-Time Checks

Generally, generating code with run-time checks enabled results in more generated code and slower MEX function execution than generating code with the checks disabled. Similarly, extrinsic calls are time consuming and increase memory usage and execution time. Disabling run-time checks and extrinsic calls usually results in streamlined generated code and faster MEX function execution. The following table lists issues to consider when disabling run-time checks and extrinsic calls.

Consider disabling... Only if...
Memory integrity checks You have already verified that array bounds and dimension checking is unnecessary.
Responsiveness checks You are sure that you will not need to stop execution of your application using Ctrl+C.
Extrinsic calls You are using extrinsic calls only for functions that do not affect application results.

How to Disable Run-Time Checks

You can disable run-time checks explicitly from the project settings dialog box, the command line, or a MEX configuration dialog box.

Disabling Run-Time Checks Using the MATLAB Coder App

  1. To open the Generate dialog box, on the Generate Code page, click the Generate arrow.
  2. Set Build type to MEX.
  3. Click More Settings.
  4. On the Speed tab, clear Ensure memory integrity, Enable responsiveness to CTRL+C and graphics refreshing, or Keep Extrinsic calls, as applicable.

Disabling Run-Time Checks From the Command Line

  1. In the MATLAB workspace, define the MEX configuration object:
    mexcfg = coder.config('mex');
  2. At the command line, set the IntegrityChecks, ExtrinsicCalls, or ResponsivenessChecks properties to false, as applicable:
    mexcfg.IntegrityChecks = false;
    mexcfg.ExtrinsicCalls = false;
    mexcfg.ResponsivenessChecks = false;