| Using Simulink | ![]() |
Working with Model Workspaces
Simulink provides each model with its own workspace for storing variable values. The model workspace is similar to the base MATLAB workspace except that
If both the MATLAB workspace and a model workspace define a variable of the same name (and the variable does not appear in any intervening masked subsystem or referenced model workspaces), Simulink uses the value of the variable in the model workspace. A model's workspace effectively provides it with its own name space, allowing you to create variables for the model without risk of conflict with other models.
The data source can be the model's MDL-file, a MAT-file, or M-code stored in the model file (see Data source for more information).
Simulink.Parameter objects
Simulink.Signal objects whose storage class is auto
However, you can tune model workspace variables declared as model arguments (see Using Model Arguments for more information).
| Note When resolving references to variables used in a referenced model, i.e., a model referenced by a Model block (see Referencing Models), Simulink resolves the referenced model's variables as if the parent model does not exist. For example, suppose a referenced model references a variable that is defined in both the parent model's workspace and in the MATLAB workspace but not in the referenced model's workspace. In this case, Simulink uses the variable defined in the MATLAB workspace. |
| Using Callback Functions | Changing Model Workspace Data | ![]() |
© 1994-2005 The MathWorks, Inc.