This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Command Window

Select the Command Window

Description

The Command Window enables you to enter individual statements at the command line and view the generated results.

Open the Command Window

The Command Window is always open. To restore the Command Window to the default location, go to the Home tab, and in the Environment section, click Layout. Then, select from one of the default layout options.

To bring focus to the Command Window from another tool such as the Editor, type commandwindow.

Examples

expand all

Create a line plot and then bring focus back to the Command Window.

x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)

commandwindow

Programmatic Use

expand all

commandwindow selects the MATLAB® Command Window. For example, type commandwindow after a plotting command to bring focus back to the Command Window.

commandwindow is not supported when running MATLAB with the -nodesktop option.

Tips

To determine the number of columns and rows that display in the Command Window given its current size, type matlab.desktop.commandwindow.size in the Command Window. MATLAB returns the number of columns and rows, respectively. For example:

matlab.desktop.commandwindow.size
ans =
   133    24

The number of columns is based on the width of the Command Window. If the Set matrix width to eighty columns Command Window preference is selected, the number of columns is always 80. For more information, see Set Command Window Preferences.

Introduced before R2006a