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. In MATLAB® Online™, to search text in the Command Window, use the Ctrl+F keyboard shortcut to open the find and replace dialog box.
Search Using Find Dialog Box
To search for specified text in the Command Window, on the Command Window title bar, click the action button , 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.
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.
Ctrl+Shift+S Ctrl+S Initiate a backward incremental search.
Ctrl+Shift+R Ctrl+R 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.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 forb
andB
. 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.
Ctrl+W Find the next occurrence of a set of characters.
Ctrl+S Remove characters from the incremental search field, back to the last successful search
Ctrl+G If you search for a set of characters 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 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 the action button , 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.
In MATLAB Online, to search for text in the Command History window, click the Command History icon in the sidebar and use the Search field to perform a search.
See Also
Command Window | Command History