Documentation

Variables

Assign variable values using model workspace, symbols, data objects, and data classes

You can use MATLAB® variables to configure and manage the signals and block parameters in your model. For more information about how models use variables, see Symbol Resolution.

In addition to numeric variables, you can use data objects to parameterize a model. Data objects allow you to control many attributes of model signals and parameters, such as data types and code generation settings, by adjusting the properties of variables in a workspace. For more information, see Data Objects.

You can store model variables in the MATLAB base workspace, a model workspace, or a data dictionary.

All model files have a model workspace you can use to store variables. For more information, see Model Workspaces.

You can create separate data dictionary files to store model variables. You can add and remove data dictionaries to and from models, reference the contents of a dictionary in other dictionaries, and track changes to a dictionary. For more information, see What Is a Data Dictionary?

Functions

getVariable Get value of variable from workspace
hasVariable Determine if variable exists in workspace
Simulink.findVars Find variables in models and blocks
matlab.io.saveVariablesToScript Save workspace variables to MATLAB script
set_param Set system and block parameter values
get_param Get parameter names and values
Simulink.data.dictionary.create Create new data dictionary and create Simulink.data.Dictionary object
Simulink.data.dictionary.open Open data dictionary for editing
Simulink.data.evalinGlobal Evaluate MATLAB expression in context of Simulink model
Simulink.data.assigninGlobal Modify variable values in context of Simulink model
Simulink.data.existsInGlobal Check existence of variable in context of Simulink model
Simulink.data.dictionary.cleanupWorkerCache Restore defaults after parallel simulation with data dictionary
Simulink.data.dictionary.setupWorkerCache Enable parallel simulation with data dictionary

Classes

Simulink.ModelWorkspace Describe model workspace
Simulink.WorkspaceVar Contains information about workspace variables and blocks that use them
Simulink.VariableUsage Get information about workspace variables and blocks that use them
Simulink.data.Dictionary Configure data dictionary
Simulink.data.dictionary.Section Configure data dictionary section
Simulink.data.dictionary.Entry Configure data dictionary entry
Simulink.data.dictionary.EnumTypeDefinition Store enumerated type definition in data dictionary
Was this topic helpful?