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
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
Search Using Keyboard Shortcuts
You can also perform an incremental search in the Command Window using keyboard shortcuts.
Begin an incremental search by using one of the defined keyboard shortcuts.
Action Windows® Default Shortcut Macintosh 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
Findicates a forward search.
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. However, if you enter uppercase letters, MATLAB only looks for instances that match the case you entered.
Perform incremental search actions using these keyboard shortcuts:
Action Keyboard 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,
Failingappears in the incremental search field.
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.
In the Command History window, type in the Search field. To display the Search field if it is not visible, click , and then select Find.
Begin typing your search term.
The Command History window searches backward and selects the previous entry that contains the sequence of letters you typed.
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).
Find the previous or next occurrence of the entry with the up and down arrow keys, respectively.
Press Esc to clear the search.