Ken & Mike on the MATLAB Desktop

April 13th, 2007

Finding items in the History or Current Directory browser

My Command History can get pretty large and I often find myself wanting to find a command I executed a couple of weeks ago (otherwise I may have to go find the command in the doc again). I used to have to hit ctrl-F and bring up the Find dialog to search through the history. While that works, it feels a bit heavyweight for the task at hand. Other options include scrolling around an looking for the command or using up arrow in the Command Window.

We added a new feature in R2007a that will help you find items in the Current Directory browser or Command History by typing right on these components. In past releases, these components only had one key type searching (i.e. they would only find the first letter of the key typed). Now, I can just start typing multiple keys the command in the history and the match is selected in the history. Below I typed “fig” and the most recent item that matches is selected. I can see what has been typed in the tooltip that appears at the top of the window.

historysearch1.jpg

I can keep typing to further search for the item.

historysearch21.jpg

If I find a match, but it is not the one I want, up arrow will take me to the next match. If I want to copy all of the or delete all occurrences, ctrl-a will select all of the matches. In this next screenshot, I hit ctrl-a (or command-a for fellow mac users) to select all the matches.

historysearchall.jpg

If no match is found, the tooltip will indicate that it did not find a match.

historysearchnone.jpg

You can also search for files in the Current Directory browser with this new feature.

directorysearch.jpg

Let me know how you like this new feature.

5 Responses to “Finding items in the History or Current Directory browser”

  1. B. Roossien replied on :

    Another very usefull tip I can use. Keep them coming!

  2. Eric Sampson replied on :

    In addition to what Kristin mentioned, there is also the feature that you can use ‘*’ as a wildcard character at the start and middle of your word searches:

    *ure %matches figure
    f*re %also matches figure

    Cheers,
    Eric Sampson

  3. Tony B replied on :

    I submitted this as a feature request a few months ago, but I thought I’d mention it here as well, since it is somewhat related. I have a set of commands that I run frequently, and I generally access them by typing the first few letters and then hitting up-arrow in the command window. An example of this type of command would be opening a database connection:
    databaseConn = database(’DatabaseName’, ”, ”);
    which is both frequently used and typed in exactly the same way every time.

    However, sometimes if I spend a lot of time doing something else in matlab, or have more than one open for some reason, these “greatest hits” commands will cycle out of the command history buffer and I will have to type them in again in full. It would be nice if I could save these greatest hits to a separate file, and then matlab would make sure they were always available in the command history.

    Thanks,
    Tony

  4. Kristin replied on :

    I would suggest selecting the commands and dragging them up the shortcuts toolbar so that they are saved and readily available. You can also select them and use the context menu to put them into a new M-file.

    As for your suggestion, are you looking to save out a history file and the reopen it? Or, for a section of the history that had “saved” commands?

  5. Tony B replied on :

    Thanks very much for your reply. I could definitely save these commands somewhere else like the shortcut bar, but I find that using the technique of typing a few letters and then up-arrow is much faster and more convenient than moving to the mouse and clicking somewhere else.

    Most of the time this works fine, because I use these commands often enough that they are generally available in the command history. However, since the history file is finite, they sometimes cycle out and are unavailable for the up-arrow trick. So what I would like is to ensure that these few “greatest hits” always appear in the command history, so that they are always available for the up-arrow trick.

    Thanks again!
    Tony

    ps. If you get really excited about this, you can look at the technical support discussion where I eventually requested a new feature; the thread id from that email was 1-3JJ17N. They provided a script that attempted to accomplish this objective, but didn’t work for me.

Leave a Reply


Ken & Mike work on the MATLAB Desktop team.
  • Ken: Hi Aurelien, This is an interesting idea! I’ll bounce it off of a few other MathWorkers. Applications in...
  • AurĂ©lien Queffurust: Happy new year guys! Ok I have 2 ideas (which would’nt be a major enhancement!) 1) What...
  • Jody: I keep Matlab open for a while (good job on stability!) and can end up with 15 or 20 files, particularly if I...
  • Arthur: Another helpful tweak to the F1 documentation in the editor would be to open the documentation of the...
  • Mike: @Jveer, I’ve had the opportunity to talk to some MEX-heads here and they confirmed the point about...
  • Mike: @Naor, We’re glad you’re enjoying the function hints. Spell checking is something we’re...
  • Ken: @Naor, I too could use spell checking in the comments. @Jody, That’s a great request [an Emacs style...
  • Jveer: how about a proper and interactive way of setting up the compiler for xcode on the mac version? or at least a...
  • Jody: I like the hints as well. I’d really like to see a better buffer switching mechanism (to use the emacs...
  • Rick Candell: It is very desirable to be able to print colored text to the command window. Why has this feature not...

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