| Simulink Reference | ![]() |
Description
Instances of this class describe model workspaces. Simulink creates an instance of this class for each model that you open during a Simulink session. See Working with Model Workspaces for more information.
Property Summary
Method Summary
| Name |
Description |
|
Assign a value to a variable in the model's workspace. |
|
Clear the model's workspace. |
|
Evaluate an expression in the model's workspace. |
|
Reload the model workspace from the workspace's data source.. |
|
Save the model's workspace to a specified MAT-file. |
|
Save the workspace to the MAT-file that the workspace designates as its data source. |
|
List the variables in the model workspace.. |
Methods
assignin
Purpose: Assign a value to a variable in the model's workspace.
Syntax: assignin('varname', varvalue)
Description: This method assigns the value specified by varvalue to the variable whose name is varname.
See also: evalin
clear
Purpose: Clear the model's workspace.
Description: This method empties the workspace of its variables.
evalin
Purpose: Evaluate an expression in the model's workspace.
Description: This method evalues expression in the model workspace.
See also: assignin
reload
Purpose: Reload the model workspace from the workspace's data source.
Description: This method reloads the model workspace from the data source specified by its DataSource parameter.
See also: saveToSource
save
Purpose: Save the model's workspace to a specified MAT-file.
Description: This method saves the model's workspace to the MAT-file specified by filename.
hws = get_param('mymodel','modelworkspace') hws.DataSource = 'MAT-File'; hws.FileName = 'workspace'; hws.assignin('roll', 30); hws.saveToSource; hws.assignin('roll', 40); hws.save('workspace_test.mat');
See also: reload, saveToSource
saveToSource
Purpose: Save the workspace to the MAT-file that it designates as its data source.
Description: This method saves the model workspace designated by its FileName property.
hws = get_param('mymodel','modelworkspace') hws.DataSource = 'MAT-File'; hws.FileName = 'params'; hws.assignin('roll', 30); hws.saveToSource;
whos
Purpose: List the variables in the model workspace.
Description: This method lists the variables in the model's workspace. The listing includes the size and class of the variables.
>> hws = get_param('mymodel','modelworkspace'); >> hws.assignin('k', 2); >> hws.whos Name Size Bytes Class k 1x1 8 double array
| Simulink.ModelDataLogs | Simulink.MSFcnRunTimeBlock | ![]() |
© 1994-2005 The MathWorks, Inc.