Ken & Mike on the MATLAB Desktop

June 15th, 2007

Scroll less with Editor Bookmarks

When I am working on code, I find that I often need to move back and forth between two places in the code - sometimes several places in the code. The best way to do this in MATLAB is with Bookmarks in the Editor. To add a bookmark in a file, place your caret on the line that you wish to mark, and then select the Go menu, Set/Clear Bookmark menuitem:

set bookmark

You can also use the Ctrl-F2 (On the Mac, Command-F2) keybinding to set a bookmark instead of using the menuitem.

A blue bookmark will be added to the gutter next to the line numbers:

set bookmark

Now you can easily move between bookmarks using the F2 key to move to the next bookmark and the Shift-F2 to go back to the previous bookmark, no matter where you are in the file.

5 Responses to “Scroll less with Editor Bookmarks”

  1. junziyang replied on :

    Great! I’ll have a try! Thanks!

  2. Markus replied on :

    I have tried the bookmarks, but when I close and re-open a file, they are gone. Like this, the bookmarks are only of very limited use for me.

  3. Ruben Faibish replied on :

    Is there a possibilty to save the bookmarks? I am talking about something similar to the breakpoints that you can get by using dbstatus and then save them. I looked at the java classes that control the MATLAB editor, but I couldn’t find anything related to the bookmarks.

  4. Kristin replied on :

    Not at this time, but we are looking into it.

  5. Hugh Thompson replied on :

    I absolutely agree - the ability to save bookmarks would be a tremendous feature, and I am very surprised it does not already exist. When working with very long, complex files, bookmarks can greatly simplify navigation - but they are of little use if they disappear every time you close the file!

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.