Getting Started    

Command Line Editing

Various arrow and control keys on your keyboard allow you to recall, edit, and reuse commands 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 misspelled command 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 commands from the Command History. For more information, see Command History.

The list of available command line editing keys is different on different computers. Experiment to see which of the following keys is available on your machine. (Many of these keys will be familiar to users of the Emacs editor.)


Ctrl+p
Recall previous line

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
Del
Ctrl+d
Delete character at cursor
Backspace
Ctrl+h
Delete character before cursor

Ctrl+k
Delete to end of line


 Entering Long Command Lines Graphics