View Values of Parameters Set as Variables
When you specify the value of a Simulink® parameter as a variable or as an expression that contains variables, the Block Parameters dialog box and the Property Inspector display the value of the variable or the expression.
The text box where you enter the parameter value displays the variable or expression on the left and the value on the right.
Note
Numerical values are displayed in the shortG format. For more information about
the shortG format, see format
.
With this in-place display of parameter values, you can check the value of a parameter in the same text field where you define the parameter.
To see the value the variable or expression has during simulation, run the simulation and open the Block Parameters dialog box or the Property Inspector. The displayed value is the value of the variable or expression in the simulation at the time step when you open the Block Parameters dialog box or the Property Inspector.
If the variable represents a data type that cannot be evaluated, the data type or class is displayed instead of a value. For example, if the variable represents an object, the class is displayed.
In-Place Parameter Value Display for Different Data Types
What the text field displays depends on the data type and dimensions of the parameter value. The table shows the display according to data type and, where relevant, dimension.
Data Type and Dimension | Display | Example |
---|---|---|
1-D or 2-D matrix with four elements or fewer | Values of all elements |
x=[1,2;3,4]; |
Matrix with more than two dimensions or more than four elements | Dimensions and data type |
x=[1 2 3 4 5]; |
String | Value |
x="position"; |
Character vector | Value |
x='position'; |
Cell array | Dimensions and data type |
x={'a','b','c'}; |
Structure | Data type |
x.a=1; x.b=2; x.c=3; |
Object | Class Note The class is displayed as a hyperlink. When you click the hyperlink, the MATLAB File Help for the class opens. | Create the x=BasicClass; |
In-Place Parameter Value Display for Variables Defined in Multiple Workspaces
To see how a variable is evaluated when the same variable name is used to represent different values in different workspaces, see Symbol Resolution Process.
Turn Off In-Place Parameter Value Display
To turn the value display off, in the Simulink Toolstrip, on the Modeling tab, in the Evaluate and Manage section, click Environment, then click Simulink Preferences. Select Editor, then clear Show evaluated value in place.
Note
Settings in the Simulink Preferences are applied to all Simulink windows and persist from one session to the next.
See Also
Create, Edit, and Manage Workspace Variables | Edit and Manage Workspace Variables by Using Model Explorer