Development Environment    

Searching in the Command Window

You can search for a specified string that appears in the Command Window, where the string was either part of input you supplied, or output displayed by MATLAB. There are two search features for the Command Window:

After finding the text, you can copy and paste it to the prompt in the Command Window to run it, or into an M-file or other file.

See also Recalling Previous Lines, Tab Completion, and Arrow and Control Keys in the Command Window for techniques to reuse previous statements.

Find Dialog

To search for a string

  1. Select Find from the Edit menu.
  1. The Find dialog box appears. This is similar to the Find dialog box in the Editor/Debugger browser

  1. In the Find dialog box, perform these steps to find all occurrences of the string you want to find in the Command Window:
    1. Type the string in the Find what field.
    2. Select Command Window from the Look in list box.
    3. Limit the search using Match case, Whole word, or Wrap around. These settings are remembered for your next MATLAB session.
  2. Click Previous or Next to find the previous occurrence or the next occurrence of the string in the Command Window, starting at the current cursor position.
  1. The string is highlighted in the Command Window.

    MATLAB beeps when a search for Next reaches the bottom of the Command Window, that is, the prompt, or when a search for Previous reaches the top of the Command Window. If you have Wrap around selected, it continues searching after beeping.

  1. To find the next occurrence, click Previous or Next again.

Note that you can only search for strings currently displayed in the Command Window. To increase the amount of information maintained in the Command Window, increase the setting for Command session scroll buffer size in Command Window preferences, and do not clear the Command Window.

Example Using the Command Window Find Dialog

This example shows the Find dialog completed to find the string ode and shows the results, ode highlighted in the Command Window.


  Keeping a Session Log Incremental Search