|On this page…|
You can search text currently in the Command Window. This includes text that is currently visible on the screen, as well as text that is in the scroll buffer.
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. Be aware that 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.
This topic shows how to perform an incremental search in the Command Window.
With the incremental search feature, you do not have to leave the Command Window while you perform your search.
Begin an incremental search using one of the following keyboard shortcuts, depending on your operating system's active settings file.
|Action||Windows® Default Active Settings||Macintosh or Emacs Default Active Settings|
Initiate a forward incremental search.
Initiate a backward incremental search.
An incremental search field appears at the bottom of the Command Window. For a forward search, the text F incSearch appears. The F indicates a forward search.
Begin typing your search term.
When you enter lowercase letters in the Inc Search field, incremental search looks for both lowercase and uppercase instances of the letters. For example, if you enter b, incremental search looks for b and B. However, if you enter uppercase letters, incremental search only looks for instances that match the case you entered.
Perform incremental search actions using the following keyboard shortcuts.
Complete a partially highlighted string of characters.
Find the next occurrence of a string of characters.
Remove characters from the Inc Search field, back to the last successful search
If you search for a string that does not appear in the Command Window text, Failing appears 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 Inc Search field disappears. The cursor remains at the position where the text was last found, with the search text highlighted.
This topic shows two methods to find text in the Command History Window.
To quickly find entries in the Command History Window based on the first few letters or numbers in the entry:
Type the first few letters or numbers of the entry you want to find in the Command History window.
The Command History window searches backwards and selects the previous entry that begins with the letters you typed. A tooltip with the text: Search history for:, appears at the top of the Command History window.
Search for additional instances by doing one of the following:
Find the previous or next occurrence of the entry with the up and down arrow keys, respectively.
Highlight each occurrence of the entry found, while you search for additional instances, press the Ctrl key with the up or down arrow key.
Highlight all instances of the entry, press Ctrl+A.
You can find text in the Command History Window that matches the case, whole word, or partial word.
On the Command History title bar, click , and then select Find. The search begins at the current cursor position. Find does not identify entries in collapsed nodes.