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:
You can also use the Ctrl-F2 (On the Mac, Command-F2) keybinding to set a bookmark instead of using the menuitem.
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.
By
Kristin Thomas
Kristin is a developer on the MATLAB Desktop team. She works primarily on the Command Window when she is not throwing herself down a mountain on her snowboard.
Great! I’ll have a try! Thanks!
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.
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.
Not at this time, but we are looking into it.
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!