Desktop Tools and Development Environment Previous page   Next Page

Viewing Values in the Command Window

You can examine values while in debug mode at the K>> prompt. To see the variables currently in the workspace, use who. Type a variable name in the Command Window and MATLAB displays its current value. For the example, to see the value of n, type

n

MATLAB returns the expected result

n =
    2

and displays the debug prompt, K>>.

Viewing Values in the Workspace Browser and Array Editor

You can view the value of variables in the Value column of the Workspace browser. The Workspace browser displays all variables in the current workspace. Use the Stack in the Workspace browser to change to another workspace and view its variables.

Image of Workspace browser showing the variable n and its value and class.

The Value column does not show all details for all variables. To see details, double-click a variable in the Workspace browser. The Array Editor opens, displaying the content for that variable. You can open the Array Editor directly for a variable using openvar.

To see the value of n in the Array Editor for the example, type

openvar n

and the Array Editor opens, showing that n = 2 as expected.

Image of Array Editor showing n.

Evaluating a Selection

Select a variable or equation in an M-file in the Editor/Debugger. Right-click and select Evaluate Selection from the context menu. MATLAB displays the value of the variable or equation in the Command Window. You cannot evaluate a selection while MATLAB is busy, for example, running an M-file.


Previous page  Viewing Values as Datatips in the Editor/Debugger Examining Values in the Example Next page

© 1994-2005 The MathWorks, Inc.