image thumbnail

Editor Session Manager

version 1.3.0.0 (12.4 KB) by Marshall
Save, load and manage sets of files and layout used in the Matlab Editor.

864 Downloads

Updated 03 Jun 2014

View License

Save the file names and layout of currently open files in the matlab editor as a project workspace session. Different sessions can be saved and loaded.
I often group open files in different tiles in the editor. Switching from Matlab 2008b to 2013b the files from the last time I used matlab would open, but no longer in the correct place in the editor. This submission is the result of 'fixing' the problem also allowing you to open not just what was open last time (if the session was saved), but any set of files from a saved session.
A session also saves the current folder in Matlab (present working directory) and opening a session will automatically change the current folder to it. This lets you open sessions with files in completely different locations while changing the present working directory automatically as well. There is also an option to automatically add sub folders to the path when saving/loading a session. I group files based on similar functions as if it were a package, and adding sub-folders to the path allows me to keep files organized without requiring the naming complexity of packages.
USAGE:
Save the zip file and unzip to the matlab path. Make sure that they are placed on the user path so that matlab can find them when first opened (allowing shortcuts to work). Running 'editorLayout.copyFilesToUserPath()' should do this automatically for you if you don't want to deal with it yourself.
'editorLayout.createShortcuts()' will add shortcuts to load, save, and manage editor sessions in the shortcuts bar. I then manually edit these shortcuts (right click-edit) to add them to my quick access toolbar and choose different icons for them (I choose the M, L and S for Manage, Load and Save).
You can also use the command line directly by calling any of:
editorLayout.SessionEditor.saveSession();
editorLayout.SessionEditor.saveSession('NameOfNewSession');
editorLayout.SessionEditor.openSession();
editorLayout.SessionEditor.manageSessions();
DETAILS:
The editor sessions, files, and layouts are stored in an xml file in the preferences directory prefdir named 'savedEditorSessions.xml'.

Known Issues:
-Datatips don't seem to appear anymore in the editor (e.g. variable values: can still highlight then press F9 to see value; Code anlyzer warnings/error messages: right click or click or click and press Ctl-M to get the message to appear when hovering over the underlined text)
-The way the layout is restored breaks some functionality in the editor:
Hovering over the tile splitter square doesn't bring up the little x to merge tiles. Workaround: right clicking on it will give you an option to do the same.
-Sometimes dragging files to different tiles after loading a session will leave a blank tile. Work around: put a different file there, or move files to adjacent tiles where there is a tile splitter between them that can merge them.

Cite As

Marshall (2021). Editor Session Manager (https://www.mathworks.com/matlabcentral/fileexchange/46352-editor-session-manager), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: SaveCurrentEditorFiles

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!