To do this, position your mouse pointer over the variable. The current value of the
variable appears in a data tip. The data tip stays in view until you move the pointer. If
you have trouble getting the data tip to appear, click the line containing the variable,
and then move the pointer next to the variable.
Data tips are always enabled when debugging a file in the Editor. To view data tips
when editing a file in the Editor, enable them in your MATLAB preferences.
1
On the Home tab, in the Environment section, click Preferences. Then
select MATLAB > Editor/Debugger > Display.
(^2) Under General display options, select Enable datatips in edit mode.
- View variable values in the Command Window.
To see all the variables currently in the workspace, call the who function. To view the
current value of a variable, type the variable name in the Command Window. For the
example, to see the value of a variable n, type n and press Enter. The Command
Window displays the variable name and its value.
When you set a breakpoint in a function and attempt to view the value of a variable in a
parent workspace, the value of that variable might not be available. This error occurs
when you attempt to access a variable while MATLAB is in the process of overwriting it.
In such cases, MATLAB returns the following message, where x represents the variable
whose value you are trying to examine.
K>> x
Reference to a called function result under construction x.
The error occurs whether you select the parent workspace by using the dbup command
or by using Function Call Stack field in the Debug section of the Editor tab.
Examine Values While Debugging