Main Content

Control Run-Time Checks

Types of Run-Time Checks

In simulation, the code generated for your MATLAB Function block includes the following run-time checks:

  • Memory integrity checks

    These checks detect violations of memory integrity in code generated for MATLAB Function blocks and stop execution with a diagnostic message.

    Caution

    For safety, these checks are enabled by default. Without memory integrity checks, violations result in unpredictable behavior.

  • Responsiveness checks in code generated for MATLAB Function blocks

    These checks enable periodic checks for Ctrl+C breaks in the generated code. Enabling responsiveness checks also enables graphics refreshing.

    Caution

    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®.

When to Disable Run-Time Checks

Generally, generating code with run-time checks enabled results in more lines of generated code and slower simulation than generating code with the checks disabled. Disabling run-time checks usually results in streamlined generated code and faster simulation, with these caveats:

Consider disabling:Only if:
Memory integrity checksYou are sure that your code is safe and that all array bounds and dimension checking is unnecessary.
Responsiveness checksYou are sure that you will not need to stop execution of your application using Ctrl+C.

How to Disable Run-Time Checks

MATLAB Function blocks enable run-time checks by default, but you can disable them explicitly for all MATLAB Function blocks in your Simulink® model. Follow these steps:

  1. Open your MATLAB Function block.

  2. In the MATLAB Function Block Editor, select Simulation Target.

  3. In the Configuration Parameters dialog box, clear the Ensure memory integrity or Ensure responsiveness check boxes, as applicable, and click Apply.

See Also

Related Topics