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

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


Ken & Mike work on the MATLAB Desktop team.
  • DP: Hi i have a problem with ezplot3, i want to plot more than i curve in the same graph but hold on command...
  • Ken: Hi Arsalan, Unfortunately there is no way to get the new Editor API in older versions of MATLAB. -Ken
  • Arsalan: Hi, I am very excited about the MATLAB API for editor because right now i am working on a project and i need...
  • Johannes: Since I started using matlab-emacs some days ago I never experienced Emacslink. But I experienced some...
  • Francisco J. Beron-Vera: Hi all, I have recently learned about ViEmu (http://www.vimemu.c om) which, for Vi/Vim...
  • OysterEngineer: When I first learned of the Publish feature in MatLab, I thought it might be useful to help to...
  • Ken: Hi Herve, I’m not quite sure what you mean by “stand-alone&# 8221; mode? -Ken
  • Herve: I wonder when the publish fonction will be supported in standalone mode.
  • Mike: Ravi, What you described should work as far I understand it. Please follow up with technical support. With a...
  • Mike: @Daniel, Thanks for that note.

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