Desktop Tools and Development Environment |
|
Incremental Search
With the incremental search feature, the cursor moves to the next or previous occurrence of the specified text in the current file. It is similar to the Emacs search feature. Incremental search is also available in the Command Window--see Incremental Search.
To use the incremental search feature in the Editor/Debugger, follow these steps:
- Position the cursor where you want the search to begin.
- How you begin the incremental search depends on your setting for the Editor/Debugger key bindings preference and in which direction you want to search:
- Press Ctrl+S to search forward or Ctrl+R to search backward for Emacs and Macintosh key binding (for Macintosh key bindings, you can also use the Command key instead of Ctrl).
- Press Ctrl+Shift+S to search forward or Ctrl+Shift+R to search backward for Windows key bindings (for Macintosh key bindings, you can also use the Command key instead of Ctrl).
- An incremental search field appears in the left side of the status bar of the current file window. F Inc Search means search Forward from the cursor. The field label is instead R Inc Search when you search backwards.
- In the incremental search field, type the text you want to find. For example, type
plot
.
- As you type the first letter,
p
, the first occurrence of that letter after the cursor is highlighted. In the example shown, the cursor is in the middle of line 2, so the first occurrence of p
, the p
in problem
on line 2, is highlighted.
Incremental search is case sensitive for uppercase letters. In the above example, searching for uppercase P
, would instead find the P
in Prepare
on line 3.
When you type the next letter in the term you are searching for, the first occurrence of the term becomes highlighted. In the example, when you add the letter l
to the p
so that the incremental search field now has pl
, the pl
in plot
on line 8 is highlighted. When you add ot
to the term in the incremental search field, the whole word plot
in line 8 is highlighted.
- If you mistype in the incremental search field, use the backspace key to remove the last letters and make corrections.
- After finding the
p
, press Ctrl+W to highlight the rest of the word found, in this case plot
, which also puts the complete word in incremental search field.
- To find the next occurrence of
plot
in the file, press Ctrl+S. To find the previous occurrence of the text, press Ctrl+R.
- If MATLAB beeps, it either means the search is at the end or beginning of the file, or it means that the text was not found.
- When the text is not found,
Failing
appears in the incremental search field. Modify the search term in the incremental search field and try again.
- When at the end or beginning of the file, press Ctrl+S or Ctrl+R again to wrap to the beginning (or end) of the file and continue the search.
- To end the incremental search, press Esc or Enter, or any other noncharacter or number key except Tab or backspace.
- The incremental search field no longer appears in the status bar. The cursor is now located at the position where the string was last found.
If you press Ctrl+S or Ctrl+R after displaying the blank incremental search field, the search term from your previous incremental search appears in the field. Then the Back Space key deletes the entire previous search term, rather than just the last letter.
| Finding Text in Files | | Opening a Selection in an M-File | |
© 1994-2005 The MathWorks, Inc.