Simulate custom code in a separate process
Run custom code in a separate process outside of MATLAB® during model simulation. This option applies to external code integrated into the model using C Caller, C Function, MATLAB Function, and MATLAB System blocks and Stateflow® charts.
Category: Simulation Target
Custom code runs in a separate process during model simulation, thus preventing a MATLAB crash due to unexpected exceptions in the custom code or errors in the interface between Simulink® and the custom code. A run-time exception in the custom code produces an error message in Simulink that provides detailed information about the exception, such as which block or line number is responsible, to help resolve any issues with the code. If a supported external debugger is installed, the error message provides a button to launch the external debugger. For more information, see Debug Custom C/C++ Code.
Selecting this parameter allows you to map a pointer type argument of a custom code C function to an output port of a C Caller block without explicitly specifying its size in the Port Specification table of the block. See Map C Function Arguments to Simulink Ports.
Custom code runs in the same process as the rest of the model during simulation. Simulation usually runs faster, but a run-time exception in the custom code could cause MATLAB to crash.
|Safety precaution||No impact|
Model Configuration Parameters: Simulation Target | C Caller | C Function | MATLAB Function | MATLAB System