Development Environment    

Command Line Editing

These are time-saving features you can use in the Command Window:

Clipboard Features.   Use the Cut, Copy, Paste, Undo, and Redo features from the Edit menu when working in the Command Window. Some of these features are also available in the context menu for the Command Window.

Recalling Previous Lines.   Use the arrow, tab, and control keys on your keyboard to recall, edit, and reuse functions you typed earlier. For example, suppose you mistakenly enter

MATLAB responds with

because you misspelled sqrt. Instead of retyping the entire line, press the key. The previously typed line is redisplayed. Use the left arrow key to move the cursor and add the missing r. Repeated use of the up arrow key recalls earlier lines.

The functions you enter are stored in a buffer. You can use smart recall to recall a previous function whose first few characters you specify. For example, typing the letters plo and pressing the up arrow key recalls the last function that started with plo, as in the most recent plot function. This feature is case sensitive.

Following is the complete list of arrow and control keys you can use in the Command Window. Many of these keys should be familiar to users of the Emacs editor.

Key
Control Key
Operation 

Ctrl+p
Recall previous line. See also Command History, which is a log of previously used functions, and Keeping a Session Log.

Ctrl+n
Recall next line.

Ctrl+b
Move back one character.

Ctrl+f
Move forward one character.
Ctrl+
Ctrl+r
Move right one word.
Ctrl+
Ctrl+l
Move left one word.
Home
Ctrl+a
Move to beginning of line.
End
Ctrl+e
Move to end of line.
Esc
Ctrl+u
Clear line.
Delete
Ctrl+d
Delete character at cursor.
Backspace
Ctrl+h
Delete character before cursor.

Ctrl+k
Delete (kill) to end of line.
Shift+home

Highlight to beginning of line.
Shift+end

Highlight to end of line.

Tab Completion.   MATLAB completes the name of a function, variable, filename, or handle graphics property if you type the first few letters and then press the Tab key. If there is a unique name, the name is automatically completed. For example, if you created a variable costs_march, type

and press Tab. MATLAB completes the name, displaying

Press Return or Enter to run the statement. In this example, MATLAB displays the contents of costs_march.

If there is more than one name that starts with the letters you typed, press the Tab key again to see a list of the possibilities. For example, type

and press Tab. MATLAB does not display anything, indicating there are multiple names beginning with cos. Press Tab again and MATLAB displays

The resulting list of possibilities includes the variable name you created, costs_march, but also includes functions that begin with cos.

Note that the list might include files which are not valid commands, including private functions.


 Font Used in the Command Window Clearing the Command Window