Main Content

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

Copyright 2018 The MathWorks, Inc

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