Getting Started Previous page   Next Page

Command Line Editing

Various arrow and control keys on your keyboard allow you to recall, edit, and reuse statements you have typed earlier. For example, suppose you mistakenly enter

You have misspelled sqrt. MATLAB responds with

Instead of retyping the entire line, simply press the key. The statement you typed is redisplayed. Use the key to move the cursor over and insert the missing r. Repeated use of the key recalls earlier lines. Typing a few characters and then the key finds a previous line that begins with those characters. You can also copy previously executed statements from the Command History. For more information, see Command History.

Following is the list of arrow and control keys you can use in the Command Window. If the preference you select for Command line key bindings is Emacs (MATLAB standard), you can also use the Ctrl+key combinations shown. See also general keyboard shortcuts for desktop tools in the MATLAB Development Environment documentation.

Key
Control Key for Emacs (MATLAB standard) Preference
Operation 

Ctrl+P
Recall previous line. Works only at command line.

Ctrl+N
Recall next line. Works only at command line if you previously used the up arrow or Ctrl+P.

Ctrl+B
Move back one character.

Ctrl+F
Move forward one character.
Ctrl+

Move right one word.
Ctrl+

Move left one word.
Home
Ctrl+A
Move to beginning of command line.
End
Ctrl+E
Move to end of command line.
Ctrl+Home

Move to top of Command Window.
Ctrl+End

Move to end of Command Window.
Esc
Ctrl+U
Clear command line.
Delete
Ctrl+D
Delete character at cursor in command line.
Backspace
Ctrl+H
Delete character before cursor in command line.

Ctrl+K
Cut contents (kill) to end of command line.
Shift+Home

Highlight to beginning of command line.
Shift+End

Highlight to end of last line. Can start at any line in the Command Window.


Previous page  Entering Long Statements Graphics Next page

© 1994-2005 The MathWorks, Inc.