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.
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:
The editor sessions, files, and layouts are stored in an xml file in the preferences directory prefdir named 'savedEditorSessions.xml'.
-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.
Marshall (2023). Editor Session Manager (https://www.mathworks.com/matlabcentral/fileexchange/46352-editor-session-manager), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: SaveCurrentEditorFiles
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
saveSession now saves over last session with the same name and saveAsSession will always add a new session.
Fix saving and loading of read only files.
-Bug fix: Layouts with only a single tile and/or floating windows now opens correctly.