Main Content

Import custom code

Description

Specify whether or not to parse available custom code variables and functions and compile custom code into its own simulation target. This option affects the C Caller block, the C Function block, the MATLAB Function block, the MATLAB System block, and Stateflow® charts.

Category: Simulation Target

Settings

Default: On

On

When this option is on, Simulink®:

  • Uses the same custom code for simulation with the C Caller block, the C Function block, the MATLAB Function block, the MATLAB System block, and Stateflow charts. When using the C Caller block or the C Function block, this option must be turned on.

  • Automatically rebuilds the custom code simulation target when specified custom code dependencies change.

  • Automatically rebuilds simulation targets for blocks using custom code when custom code changes.

  • Enables Just-In-Time (JIT) compilation of the C Caller block, the C Function block, the MATLAB Function block, the MATLAB System block, and Stateflow charts.

  • Allows the Enable custom code analysis option to enable Simulink Coverage™ and Simulink Design Verifier™ support for custom code.

  • Allows edit and compile time error detection for C interface errors from your model.

  • Calls specified initialize code and terminate code at the start and end of model simulation, respectively, regardless of whether any block in the model calls external custom code. See Initialize function and Terminate function.

  • Enables parsing of custom code to report unresolved symbols in Stateflow charts in your model.

Off

When this option is off, Simulink:

  • Splits custom code dependencies between Simulation Target and other means of specifying custom code dependencies (coder.cinclude, coder.updateBuildInfo, and coder.ExternalDependency) in Stateflow charts that use MATLAB® as the action language, MATLAB Function blocks, or MATLAB System blocks.

  • Calls specified initialize code and terminate code only if necessary. If no block in the model calls external custom code, Simulink does not call the initialize code or the terminate code. See Initialize function and Terminate function.

Note

In most cases, Import custom code should be selected. Clear the Import custom code parameter only if your custom code is incompatible with this parameter.

Command-Line Information

Parameter: SimParseCustomCode
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

ApplicationSetting
DebuggingOn
TraceabilityNo impact
EfficiencyNo impact
Safety precautionOn

Related Topics