| Contents | Index |
| 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 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 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 MATLAB Function blocks in Simulink models and 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 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. |
SimParseCustomCode string – 'off', 'on' | Simulation Target > Custom Code > Parse custom code symbols | Specify whether or not to parse the custom code and report unresolved symbols in a model. |
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' | Code Generation > 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 MATLAB Function blocks, Stateflow charts, or Truth Table blocks.) |
ReservedNameArray string array – {} | Code Generation > 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' | Code Generation > 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 MATLAB Function blocks, Stateflow charts, or Truth Table blocks.) |
CustomSourceCode string – '' | Code Generation > Custom Code > Source file | Enter code lines to appear near the top of a generated source code file. |
CustomHeaderCode string – '' | Code Generation > Custom Code > Header file | Enter code lines to appear near the top of a generated header file. |
CustomInitializer string – '' | Code Generation > Custom Code > Initialize function | Enter code statements that execute once at the start of simulation. |
CustomTerminator string – '' | Code Generation > Custom Code > Terminate function | Enter code statements that execute at the end of simulation. |
CustomInclude string – '' | Code Generation > Custom Code > Include directories | Enter a space-separated list of folder paths that contain files you include in the compiled target. |
CustomSource string – '' | Code Generation > Custom Code > Source files | Enter a space-separated list of source files to compile and link into the target. |
CustomLibrary string – '' | Code Generation > 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' | Code Generation > 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 MATLAB Function blocks, Stateflow charts, or Truth Table blocks.) |
RTWUseLocalCustomCode string – 'off', 'on' | Code Generation > 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 – '' | Code Generation > Source file | Enter code lines to appear near the top of a generated source code file. |
CustomHeaderCode string – '' | Code Generation > Header file | Enter code lines to appear near the top of a generated header file. |
CustomInitializer string – '' | Code Generation > Initialize function | Enter code statements that execute once at the start of simulation. |
CustomTerminator string – '' | Code Generation > Terminate function | Enter code statements that execute at the end of simulation. |
CustomInclude string – '' | Code Generation > Include directories | Enter a space-separated list of folder paths that contain files you include in the compiled target. |
CustomSource string – '' | Code Generation > Source files | Enter a space-separated list of source files to compile and link into the target. |
CustomLibrary string – '' | Code Generation > 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 Simulink Coder documentation.
![]() | Optimizing Generated Code | Specifying Relative Paths for Custom Code | ![]() |

Learn how engineers use Stateflow to model state machines in their Simulink models.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |