Sunday, May 31, 2009

MATLAB: Shortcut Editor State

In an earlier blog entry I documented a way to preserve that state of the editor (that is all windows open in the editor) in a .mat file that can be reloaded whenever needed.

I decided to make a shortcut of the most frequently re-loaded set of windows. It is easy to do in MATLAB:

  • Highlight code of interest.
  • Drag to shortcut toolbar.
  • Enter ‘Label’
  • Done!

For my case I added the shortcut to a personal folder accessible from the Start button (Start – Shortcuts).

shortcuts_organizer_

The code entered in the Callback field:

editorServices = com.mathworks.mlservices.MLEditorServices;

load('C:\Documents and Settings\User\My Documents\MATLAB\Editor State Files\xxxxAnalysis.mat')

for id = 1:length( editorState )
      editorServices.openDocument( editorState(id) )
      end

GRIPE ON:

What is the point of having a personal folder accessible from the Start button??

I am using it as a repository of commands that would be good to have close but not necessarily add to toolbar (and thus add to clatter). However, they do not count as ‘shortcuts’. A shortcut is an 1-2 clicks operation not something that essentially takes 3-4 clicks to launch. That counts as a sub-sub-… menu! Not to mention ‘out of sight out of mind’.

It would have been much better if by making a personal shortcut folder you actually place it as an icon to the toolbar that can be launched via a 2-click operation. And everything is right there in front of you so you do not forget your shortcuts. And everything is organized.

No comments:

Post a Comment