Development Environment |
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.
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.
p
, you can press Ctrl+W and the rest of the word that is found, in this case plot
, appears in the I-search field.
plot
in the file, press Ctrl+S. To find the previous occurrence of the string, press Ctrl+R.
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 |