This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Find Text in Command Window or History

Find Text in the Command Window

You can search text currently in the Command Window. This includes text that is visible on the screen, and text that is in the scroll buffer.

Search Using Find Dialog Box

To search for specified text in the Command Window, on the Command Window title bar, click , and then select Find. The Find dialog box opens. The search begins at the current cursor position. MATLAB® finds the text you specified and highlights it.

MATLAB beeps when a search for Find Next reaches the end of the Command Window, or when a search for Find Previous reaches the top of the Command Window. If you have Wrap around selected, MATLAB continues searching after beeping.

To search for the specified text in other MATLAB desktop tools, change the selection in the Look in field.

You can increase the amount of information available in the Command Window so that more text is available for searching. Doing so requires more memory. On the Home tab, in the Environment section, click Preferences. Select MATLAB > Command Window, and then increase the setting for Number of lines in the command window scroll buffer.

Clearing the command window (for example, with the clc function), empties the scroll buffer. The cleared text is no longer available for searching. To clear your display in the Command Window without clearing the buffer, use the home function.

Search Using Keyboard Shortcuts

You can also perform an incremental search in the Command Window using keyboard shortcuts.

  1. Begin an incremental search by using one of the defined keyboard shortcuts.

    ActionWindows® Default ShortcutMacintosh or Emacs Default Shortcut

    Initiate a forward incremental search.


    Initiate a backward incremental search.


    An incremental search field appears in the bottom right corner of the MATLAB Desktop window. For a forward search, the text F Inc Search appears. The F indicates a forward search.

  2. Begin typing your search term.

    When you enter lowercase letters in the incremental search field, MATLAB looks for both lowercase and uppercase instances of the letters. For example, if you enter b, MATLAB looks for b and B. However, if you enter uppercase letters, MATLAB only looks for instances that match the case you entered.

  3. Perform incremental search actions using these keyboard shortcuts:

    ActionKeyboard Shortcut

    Complete a partially highlighted set of characters.


    Find the next occurrence of a set of characters.


    Remove characters from the incremental search field, back to the last successful search


    If you search for a set of characters that does not appear in the Command Window text, Failing appears in the incremental search field.

  4. End incremental searching by pressing Esc (escape), Enter, or any other key that is not a character or number.

    The incremental search field disappears. The cursor remains at the position where the text was last found, with the search text highlighted.

Find Text in the Command History Window

You can search for text in the Command History Window. You can search for text either at the beginning of a command, or anywhere within a command.

  1. In the Command History window, type in the Search field. To display the Search field if is not visible, click , and then select Find.

  2. Begin typing your search term.

    The Command History window searches backward and selects the previous entry that contains the sequence of letters you typed.

  3. Select from the different search options using the buttons to the right of the search field. Options include (match case), (match anywhere within command), and (match at beginning of command).

  4. Find the previous or next occurrence of the entry with the up and down arrow keys, respectively.

  5. Press Esc to clear the search.

Was this topic helpful?