Simulink.ModelWorkspace
Interact with the model workspace of a model programmatically
Description
Use a Simulink.ModelWorkspace
object to interact with a model
workspace. For example, you can add and remove variables, set the data source of the
workspace, and save changes to the workspace.
For more information, see Model Workspaces.
Creation
To create a Simulink.ModelWorkspace
, use the get_param
function to query the value of the model parameter
ModelWorkspace
. For example, to create an object named
mdlWks
that represents the model workspace of a model named
myModel.slx
:
mdlWks = get_param('myModel','ModelWorkspace')
Properties
Object Functions
getVariable | Return value of variable in the model workspace of a model |
getVariablePart | Get value of variable property in model workspace |
setVariablePart | Set property of variable in model workspace |
hasVariable | Determine whether variable exists in the model workspace of a model |
whos | Return list of variables in the model workspace of a model |
saveToSource | Save model workspace changes to the external data source of the model workspace |
save | Save contents of model workspace to a MAT-file |
reload | Reinitialize variables from the data source of a model workspace |
evalin | Evaluate expression in the model workspace of a model |
clear | Clear variables from the model workspace of a model |
assignin | Assign value to variable in the model workspace of a model |
Examples
Version History
Introduced before R2006a