In simulation, the code generated for your MATLAB® functions includes the following run-time checks and external function calls.
Memory integrity checks
These checks detect violations of memory integrity in code generated for MATLAB functions and stop execution with a diagnostic message.
For safety, these checks are enabled by default. Without memory integrity checks, violations will result in unpredictable behavior.
Responsiveness checks in code generated for MATLAB functions
These checks enable periodic checks for Ctrl+C breaks in code generated for MATLAB functions. Enabling responsiveness checks also enables graphics refreshing.
For safety, these checks are enabled by default. Without these checks the only way to end a long-running execution might be to terminate MATLAB.
Extrinsic calls to MATLAB functions
Extrinsic calls to MATLAB functions, for example to display results, are enabled by default for debugging purposes. For more information about extrinsic functions, see Declaring MATLAB Functions as Extrinsic Functions.
Generally, generating code with run-time checks enabled results in more generated code and slower simulation than generating code with the checks disabled. Similarly, extrinsic calls are time consuming and have an adverse effect on performance. Disabling run-time checks and extrinsic calls usually results in streamlined generated code and faster simulation, with these caveats:
|Consider disabling...||Only if...|
|Memory integrity checks||You are sure that your code is safe and that all 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 only using extrinsic calls to functions that do not affect application results.|
To disable run-time checks:
Define the compiler options object in the MATLAB workspace by issuing a constructor command:
comp_cfg = coder.MEXConfig
From the command line set the
properties false, as
comp_cfg.IntegrityChecks = false; comp_cfg.ExtrinsicCalls = false; comp_cfg.ResponsivenessChecks = false;