In Stateflow® charts in Simulink® models, you can use the command-line API to set options in the Model Configuration Parameters dialog box for simulation and embeddable code generation, .
At the MATLAB® command prompt, type:
object_name = getActiveConfigSet(gcs)
This command returns an object handle to the model settings in the Model 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 that you can set for simulation of nonlibrary models using the command-line API.
Parameter and Values | Dialog Box Equivalent | Description |
---|---|---|
–
| Ensure memory integrity | Detect violations of memory integrity in code generated for MATLAB Function blocks and stop execution with a diagnostic. |
–
| Echo expressions without semicolons | Enable run-time output to appear in the MATLAB Command Window during simulation. |
–
| Ensure responsiveness | Enable responsiveness checks in code generated for MATLAB Function blocks. |
– | Simulation target build mode | Specify how you build the simulation target for a model. |
| 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. |
–
| Import custom code | Specify whether or not to parse the custom code and report unresolved symbols for the C charts in a model. |
| Source file | Enter code lines to appear near the top of a generated source code file. |
| Header file | Enter code lines to appear near the top of a generated header file. |
| Initialize function | Enter code statements that execute once at the start of simulation. |
| Terminate function | Enter code statements that execute at the end of simulation. |
| Include directories | Enter a space-separated list of folder paths that contain files you include in the compiled target. Note If your list includes any Windows® paths that contain spaces, each instance must be enclosed in double quotes within the argument, for example, 'C:\Project "C:\Custom Files"'
|
| Source files | Enter a space-separated list of source files to compile and link into the target. |
| 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.
Parameter and Values | Dialog Box Equivalent | Description |
---|---|---|
–
| 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. |
| Source file | Enter code lines to appear near the top of a generated source code file. |
| Header file | Enter code lines to appear near the top of a generated header file. |
| Initialize function | Enter code statements that execute once at the start of simulation. |
| Terminate function | Enter code statements that execute at the end of simulation. |
| Include directories | Enter a space-separated list of folder paths that contain files you include in the compiled target. Note If your list includes any Windows paths that contain spaces, each instance must be enclosed in double quotes within the argument, for example, 'C:\Project "C:\Custom Files"'
|
| Source files | Enter a space-separated list of source files to compile and link into the target. |
| Libraries | Enter a space-separated list of static libraries that contain custom object code to link into the target. |