Development Environment    

Incremental Search

With the incremental search feature, the cursor moves to the next or previous occurrence of the specified string in the current file. It is similar to the Emacs search feature.

  1. Position the cursor where you want the search to begin.
  2. How you begin the incremental search depends on your setting for the Editor/Debugger Key bindings preference:
  1. An incremental search field (I-search:) appears at the bottom of the current file window.

  1. In the I-search field, type the string you want to find. For example, type plot.
  1. As you type the first letter, p, the first occurrence of that letter in the file after the current cursor position is highlighted. In the example shown, the current line is 3 and the first occurrence of p, the P in Prepare, is highlighted.

    If you enter a lowercase letter, for example, p, incremental search looks for both lowercase and uppercase instances, for example p and P. However, if you enter an uppercase letter, for example, P, incremental search only looks for uppercase instances, for example, P.

    When you type the next letter, the first occurrence of the string becomes highlighted. In the example, when you add the letter l to the p so that the I-search field now has pl, the pl in plot on line 8 is highlighted. When you add ot to the term in the I-search field, the whole word plot in line 8 is highlighted.

  1. To find the next occurrence of plot in the file, press Ctrl+S. To find the previous occurrence of the string, press Ctrl+R.
  2. If you hear a beep it either means that the string was not found, or it means you are at the end or beginning of the file.
  1. Press Ctrl+S (or Ctrl+R) again to wrap to the beginning (or end) of the file and continue the search. Either the next occurrence of the string is highlighted, or you hear another beep indicating the string is not in the file.

  1. To end the incremental search, press Esc or Enter, or any other noncharacter or number key except Tab.
  1. The I-search: field no longer appears in the window. The cursor is now located at the position where the string was last found, with the search string highlighted.

You can type Ctrl+R (or Ctrl+Shift+R for Windows key bindings) to display the I-search: field to begin finding the previous occurrence rather than the next occurrence.

If you enter Ctrl+S or Ctrl+R after displaying the blank I-search field, the search term from your previous incremental search appears in the field. When you then use the Back Space key, you delete the entire previous search term, rather than just the last letter.

Opening a Selection in an M-File

You can open a subfunction, function, file, variable, or Simulink model from within a file in the Editor/Debugger. Select the name and then right-click and select Open Selection from the context menu. Based on what the selection is, the Editor performs a different action.

Selection
Action
Subfunction
Cursor moves to the subfunction within the current M-file. If no subfunction by that name is found in the current M-file, the Editor runs the open function on the selection, which opens the selection in the appropriate tool, as shown for the other selection types in this table.
M-file or other text file
Opens in the Editor.
Figure file (.fig)
Opens in a figure window.
Variable
Opens in the Array Editor.
Model
Opens in Simulink.
Other
If the selection is some other type, Open selection looks for a matching file in a private directory in the current directory and performs the appropriate action.


  Finding and Replacing a String Saving M-Files