Command Window

The command window is used to enter MATLAB commands and view their output.


Toolbar

The toolbar is optional, and may be turned off in the command window's preferences. The toolbar's buttons provide the following capabilities:

Open a new file in the m-file editor.
Open an existing file in the m-file editor.
Cut the selected text to the clipboard.
Copy the selected text to the clipboard.
Paste text from the clipboard into the command window.
Undo the last operation. Operations that may be undone include typing, dragging, and dropping.
Open the workspace browser.
Open the path browser.
Show the command history window.
Open the m-file debugger.
Open SIMULINK.
Open the MATLAB Help window.

Syntax coloring

As MATLAB commands are typed in the command window, they are optionally colored according to MATLAB syntax. The defaults color MATLAB keywords (if, for, end, etc.) in blue, strings in green, and comments in red. These colors are selectable in the syntax coloring preferences.

Drag and drop

Text may be dragged and dropped within the command window, from the command window to other windows or applications, and from other windows or applications to the command window. In addition, you may drag a file or folder into the command window; when you drop it, the path to that item will be dropped. Note that text before the prompt cannot be modified; text can be dropped only after the prompt.

Text that has a carriage return at the end will be executed immediately when it is dropped into the command window.

Error linking

When an error occurs in an m-file, it is displayed in the command window:

??? Undefined function or variable 'polt'.

Error in ==> HD:MATLAB:Toolbox:matlab:graph3d:surf.m
On line 44 ==> polt(1:10)

Placing the cursor on the line beginning with either "???" or "Error in ==>" and pressing the Enter key opens the offending m-file with the problem line selected.


Return to Help Desk.