Desktop Tools and Development Environment Previous page   Next Page

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

rho = (1+ sqt(5))/2

Because you misspelled sqrt, MATLAB responds with

Undefined function or variable 'sqt'.

Instead of retyping the entire line, press the up arrow key. The previously typed line is redisplayed. Use the left arrow key to move the cursor, add the missing r, and press Enter or Return to run the line. Repeated use of the up arrow key recalls earlier lines, from the current and previous sessions. Using the up arrow key, you can recall any line maintained in the Command History window.

Similarly, specify the first few characters of a line you entered previously and press the up arrow key to recall the previous line. For example, type the letters plo and then press the up arrow key. This displays the last line that started with plo, as in the most recent plot function. Press the up arrow key again to display the next most recent line that began with plo, and so on. Then press Enter or Return to run the line. This feature is case sensitive.

If the up arrow key moves the cursor up but does not recall previous lines, clear the accessibility preference. For more information, see Accessibility.

Another way to view and access commands from the current and previous MATLAB sessions is with the Command History window--see Command History.


Previous page  Enter Multiple Lines Without Running Them Tab Completion Next page

© 1994-2005 The MathWorks, Inc.