Skip to Main Content Skip to Search
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

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.)

Incremental Search Box

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!

2 Responses to “Finding items in the Command Window or the Editor”

  1. Ravi replied on :

    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?

  2. Jennifer replied on :

    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

Leave a Reply


Ken & Mike work on the MATLAB Desktop team.
  • Ken: Hi Rich, We have a bug report on the first issue you mention. As for the Command Window time-stamp format,...
  • Rich Messeder: I have a few comments that I’m trying to find the right place for. One is that when I press the...
  • Steve Eddins: Stephen—You can extend your R2008b Prerelease license by choosing the Help -> Licensing ->...
  • Mike: Stephen, We cannot give an exact date as to when the next version of MATLAB will be released.
  • Stephen Colona: Do you think the new release will come out before the PreRelease expires? Thanks.
  • Mike: Nasir, Thank you for your feedback, it helps us refine the desktop and ultimately make it easier to use....
  • Nasir: sent my desktop.
  • Mike: Han, We are always investigating new ways to enhance the MATLAB language and improve the desktop experience. I...
  • Han Geerligs: Hello Mike, first, thanks for mentioning me ;-) I was wondering if you plan to introduce more pragma...
  • Tom Clark: FOUR buttons? You’re spoiling yourselves :) Think about this… I’m pretty sure...

These postings are the author's and don't necessarily represent the opinions of The MathWorks.

Related Topics