Ken & Mike on the MATLAB Desktop
August 13th, 2007
Finding items in the Command Window or the Editor
In a recent post, Kristin described a lightweight way to search in the history and the file browser. The Command Window and the Editor also have a lightweight way to look for items. It’s called incremental search.
To do an incremental search you hit a couple keys and it brings up this nice little box at the bottom of the window. (Yes, I did just leave out the keys on purpose, I’ll explain in a minute.)

Now start typing. Each key you type refines the search. Hit Ctrl-s to go to the next match and Ctrl-r to go to the previous match. This feature is very similar to search in emacs.
Fun with keys
The one complicated part is what keys do you press? Unfortunately, the answer is that depends. Different platforms use different keys to mean the same things. We try to use the key on a platform that makes the most sense. Sometimes, however the key we want to use is already in use. Sometimes, people have different expectations of keys based on other programs they use.
Because of this we have created preferences about which key bindings you use and we try to set the defaults in a way that will make most users happy. As mentioned in a previous post, the Command Window always uses the Emacs (MATLAB Classic) set of keybindings by default and the Editor uses a platform specific set. You can change these choosing “Preferences” from the “File” menu. From the Preferences dialog, select “Keyboard” and set the keybingings to the desired set.
By default on PC Ctrl-s will bring up incremental search in the Command Window and Ctrl-Shift-s will bring it up in the Editor for forward search. By default on UNIX and Mac Ctrl-s will bring up incremental search in both the Command Window and the Editor for forward search.
To do a reverse search use the above except use r instead of s.
Have Fun!
By
Jennifer French
Jennifer French is a Quality Engineer on the MATLAB desktop team. She works on the command window and the desktop framework. She likes to knit in her spare time, but rarely does because she has two small kids.
12:30 UTC |
Posted in Command Window, Editor |
Permalink |
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
Leave a Reply
|
When I enter the function “why” in the incremental search box (obtained after typing Ctrl-s), I get a message :
Failing F Inc Search : why
What is wrong?
Hi Ravi,
Incremental search does not search the help. It searches the text that is in the Command Window or the current editor window.
If you have not executed why in the command window or used it in the currently open m-file in the editor then incremental search will not find it.
Thanks,
–Jennifer