| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Stateflow |
| Contents | Index |
| Learn more about Stateflow |
| On this page… |
|---|
How to Set Parameters at the Command Line Simulation Parameters for Nonlibrary Models Simulation Parameters for Library Models |
To programmatically set options in the Configuration Parameters dialog box for simulation and embeddable code generation, you can use the command-line API.
At the MATLAB command prompt, type:
object_name = getActiveConfigSet(gcs)
This command returns an object handle to the model settings in the Configuration Parameters dialog box for the current model.
To set a parameter for that dialog box, type:
object_name.set_param('parameter_name', value)This command sets a configuration parameter to the value that you specify.
For example, you can set the Reserved names parameter for simulation by typing:
cp = getActiveConfigSet(gcs)
cp.set_param('SimReservedNameArray', {'abc','xyz'})Note You can also get the current value of a configuration parameter by typing: object_name.get_param('parameter_name') |
For more information about using get_param and set_param, see the Simulink Reference documentation.
The following table summarizes the parameters and values in the Configuration Parameters dialog box that you can set for simulation of nonlibrary models using the command-line API. The parameters are listed in the order that they appear in the Configuration Parameters dialog box.
| Parameter and Values | Configuration Parameters Dialog Box Equivalent | Description |
|---|---|---|
SFSimEnableDebug string – 'off', 'on' | Simulation Target > Enable debugging / animation | Enable debugging and animation of a model during simulation and also enables the Stateflow Debugger. |
SFSimOverflowDetection string – 'off', 'on' | Simulation Target > Enable overflow detection (with debugging) | Enable overflow detection of data during simulation. Overflow occurs for data when a value assigned to it exceeds the numeric capacity of the data type. |
SimIntegrity string – 'off', 'on' | Simulation Target > Ensure memory integrity | Detect violations of memory integrity in code generated for Embedded MATLAB Function blocks and stop execution with a diagnostic. |
SFSimEcho string – 'off', 'on' | Simulation Target > Echo expressions without semicolons | Enable run-time output to appear in the MATLAB Command Window during simulation. |
SimBlas string – 'off', 'on' | Simulation Target > Use BLAS library for faster simulation | Enable Embedded MATLAB Function blocks in Simulink models and Embedded MATLAB functions in Stateflow charts to speed up low-level matrix operations during simulation. |
SimCtrlC string – 'off', 'on' | Simulation Target > Ensure responsiveness | Enable responsiveness checks in code generated for Embedded MATLAB Function blocks. |
SimBuildMode string – 'sf_incremental_build', 'sf_nonincremental_build', 'sf_make', 'sf_make_clean', 'sf_make_clean_objects' | Simulation Target > Simulation target build mode | Specify how you build the simulation target for a model. |
SimReservedNameArray string array – {} | Simulation Target > Symbols > Reserved names | Enter the names of variables or functions in the generated code that match the names of variables or functions specified in custom code to avoid naming conflicts. |
SimCustomSourceCode string – '' | Simulation Target > Custom Code > Source file | Enter code lines to appear near the top of a generated source code file. |
SimCustomHeaderCode string – '' | Simulation Target > Custom Code > Header file | Enter code lines to appear near the top of a generated header file. |
SimCustomInitializer string – '' | Simulation Target > Custom Code > Initialize function | Enter code statements that execute once at the start of simulation. |
SimCustomTerminator string – '' | Simulation Target > Custom Code > Terminate function | Enter code statements that execute at the end of simulation. |
SimUserIncludeDirs string – '' | Simulation Target > Custom Code > Include directories | Enter a space-separated list of folder paths that contain files you include in the compiled target. |
SimUserSources string – '' | Simulation Target > Custom Code > Source files | Enter a space-separated list of source files to compile and link into the target. |
SimUserLibraries string – '' | Simulation Target > Custom Code > Libraries | Enter a space-separated list of static libraries that contain custom object code to link into the target. |
The following table summarizes the simulation parameters that apply to library models. The parameters are listed in the order that they appear in the Configuration Parameters dialog box.
| Parameter and Values | Configuration Parameters Dialog Box Equivalent | Description |
|---|---|---|
SimUseLocalCustomCode string – 'off', 'on' | Simulation Target > Use local custom code settings (do not inherit from main model) | Specify whether a library model can use custom code settings that are unique from the main model to which the library is linked. |
SimCustomSourceCode string – '' | Simulation Target > Source file | Enter code lines to appear near the top of a generated source code file. |
SimCustomHeaderCode string – '' | Simulation Target > Header file | Enter code lines to appear near the top of a generated header file. |
SimCustomInitializer string – '' | Simulation Target > Initialize function | Enter code statements that execute once at the start of simulation. |
SimCustomTerminator string – '' | Simulation Target > Terminate function | Enter code statements that execute at the end of simulation. |
SimUserIncludeDirs string – '' | Simulation Target > Include directories | Enter a space-separated list of folder paths that contain files you include in the compiled target. |
SimUserSources string – '' | Simulation Target > Source files | Enter a space-separated list of source files to compile and link into the target. |
SimUserLibraries string – '' | Simulation Target > Libraries | Enter a space-separated list of static libraries that contain custom object code to link into the target. |
The following table is a partial list of the parameters and values in the Configuration Parameters dialog box that you can set for embeddable code generation using the command-line API. The parameters are listed in the order that they appear in the Configuration Parameters dialog box.
| Parameter and Values | Configuration Parameters Dialog Box Equivalent | Description |
|---|---|---|
UseSimReservedNames string – 'off', 'on' | Real-Time Workshop > Symbols > Use the same reserved names as Simulation Target | Specify whether to use the same reserved names as those specified for simulation. (Applies only if the model contains Embedded MATLAB Function blocks, Stateflow charts, or Truth Table blocks.) |
ReservedNameArray string array – {} | Real-Time Workshop > Symbols > Reserved names | Enter the names of variables or functions in the generated code that match the names of variables or functions specified in custom code to avoid naming conflicts. |
RTWUseSimCustomCode string – 'off', 'on' | Real-Time Workshop > Custom Code > Use the same custom code settings as Simulation Target | Specify whether to use the same custom code settings as those specified for simulation. (Applies only if the model contains Embedded MATLAB Function blocks, Stateflow charts, or Truth Table blocks.) |
CustomSourceCode string – '' | Real-Time Workshop > Custom Code > Source file | Enter code lines to appear near the top of a generated source code file. |
CustomHeaderCode string – '' | Real-Time Workshop > Custom Code > Header file | Enter code lines to appear near the top of a generated header file. |
CustomInitializer string – '' | Real-Time Workshop > Custom Code > Initialize function | Enter code statements that execute once at the start of simulation. |
CustomTerminator string – '' | Real-Time Workshop > Custom Code > Terminate function | Enter code statements that execute at the end of simulation. |
CustomInclude string – '' | Real-Time Workshop > Custom Code > Include directories | Enter a space-separated list of folder paths that contain files you include in the compiled target. |
CustomSource string – '' | Real-Time Workshop > Custom Code > Source files | Enter a space-separated list of source files to compile and link into the target. |
CustomLibrary string – '' | Real-Time Workshop > Custom Code > Libraries | Enter a space-separated list of static libraries that contain custom object code to link into the target. |
The following table summarizes the code generation parameters that apply to library models. The parameters are listed in the order that they appear in the Configuration Parameters dialog box.
| Parameter and Values | Configuration Parameters Dialog Box Equivalent | Description |
|---|---|---|
RTWUseSimCustomCode string – 'off', 'on' | Real-Time Workshop > Use the same custom code settings as Simulation Target | Specify whether to use the same custom code settings as those specified for simulation. (Applies only if the model contains Embedded MATLAB Function blocks, Stateflow charts, or Truth Table blocks.) |
RTWUseLocalCustomCode string – 'off', 'on' | Real-Time Workshop > Use local custom code settings (do not inherit from main model) | Specify whether a library model can use custom code settings that are unique from the main model to which the library is linked. |
CustomSourceCode string – '' | Real-Time Workshop > Source file | Enter code lines to appear near the top of a generated source code file. |
CustomHeaderCode string – '' | Real-Time Workshop > Header file | Enter code lines to appear near the top of a generated header file. |
CustomInitializer string – '' | Real-Time Workshop > Initialize function | Enter code statements that execute once at the start of simulation. |
CustomTerminator string – '' | Real-Time Workshop > Terminate function | Enter code statements that execute at the end of simulation. |
CustomInclude string – '' | Real-Time Workshop > Include directories | Enter a space-separated list of folder paths that contain files you include in the compiled target. |
CustomSource string – '' | Real-Time Workshop > Source files | Enter a space-separated list of source files to compile and link into the target. |
CustomLibrary string – '' | Real-Time Workshop > Libraries | Enter a space-separated list of static libraries that contain custom object code to link into the target. |
For more information about parameters and values you can specify for embeddable code generation, see Parameter Command-Line Information Summary in the Real-Time Workshop Reference documentation.
![]() | Optimizing Generated Code | Specifying Relative Paths for Custom Code | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |