Specify Source for Data in Model Workspace - MATLAB & Simulink (original) (raw)

When you use a model workspace to contain the variables that a model uses, you can choose to store the variables in one of these sources:

To specify a data source for a model workspace, in the Model Explorer, use the Model Workspace dialog box. To display the dialog box for a model workspace:

  1. Open the Model Explorer. On the Modeling tab, clickModel Data Editor.
  2. In the Model Hierarchy pane, right-click the model workspace.
  3. Select the menu item, which opens the Model Workspace dialog box.

To use MATLAB commands to change data in a model workspace, see Use MATLAB Commands to Change Workspace Data.

Data Source

The Data source field in the Model Workspace dialog box includes the following data source options for a workspace:

MAT-File and MATLAB File Source Controls

Selecting MAT-File or MATLAB File as the Data source for a workspace causes the Model Workspace dialog box to display additional controls.

Model Workspace dialog box with MAT-File selected as the data source. Other controls in the dialog box include a File name text box, and buttons to Reinitialize from Source and Save to Source.

File name

Specifies the file name or path name of the MAT-file or MATLAB file that is the data source for the selected workspace. If you specify a file name, the name must reside on the MATLAB path.

Reinitialize From Source

Clears the workspace and reloads the data from the MAT-file or MATLAB file specified by the File name field.

Save To Source

Saves the workspace in the MAT-file or MATLAB file specified by the File name field.

MATLAB Code Source Controls

Selecting MATLAB Code as the Data source for a workspace causes the Model Workspace dialog box to display additional controls.

Model Workspace dialog box with MATLAB Code selected as the data source. Other controls in the dialog box include a MATLAB Code text box, and a button to Reinitialize from Source.

MATLAB Code

Specifies MATLAB code that initializes the selected workspace. To change the initialization code, edit this field, then select the Reinitialize from source button on the dialog box to clear the workspace and execute the modified code.

Reinitialize from Source

Clears the workspace and executes the contents of the MATLAB Code field.

Create Model Mask

Mask the model, which enables you to control how users of the model interact with model arguments. For more information, see Introduction to System Mask.

See Also

Topics