This small toolbox guarantee a set of function to manage a set of different projects. You can create, delete, save, load different projects switching between them directly in matlab.
- Save and Load sessions, system wide or locally
- Switch session via command line
- User-friendly dialogs
- Name collision warnings
- A gui to manage all this features
Type (or save as shortcut)
to open the complete user interface.
Read below for manipulate sessions programmatically.
Each session is saved in a .mat file with .msession extension in your %userpath% folder on you local machine. This guarantees a safe place for sessions regardless of your current working path.
Each session file contains:
- Files opened in matlab editor
- Current directory path
- Current working path
Each session will be uniquely identified by its .msession file name. To track current session the global variable CURRENT_SESSION____ is set. A local session is always named __local
Create a new project
session.new( 'CustomName' )
Create a new session named 'CustomName'. If you don't provide any session name as first parameter, a related dialog prompts asking for the preferred name. Note that this function simplying set global variable CURRENT_SESSION____ and it's equal to
CURRENT_SESSION____ = 'CustomName'
, no file is saved yet.
Save a project
session.save( 'CustomName' )
Save current session. By default without arguments, it gets current session name from global variable CURRENT_SESSION____, otherwise use 'CustomName' as new session name, update current session accordly and save the CustomName.msession file. If no current session is available, a new one will be created.
Load a project
session.load( 'CustomName' )
Load the related session named 'CustomName' if it exists. If you don't provide any session name or if it doesn't exists, prompt a selection dialog with the complete list of all session avilable on your machine.
Loading a session will set current working direcotry, path and editor files. If another session is open asks you if you want to save it in advance.
Delete a project
session.delete( 'CustomName' )
Delete the related session named 'CustomName' if it exists. If you don't provide any session name or if it doesn't exists, prompt a selection dialog with the complete list of all session avilable on your machine.
You can manage a local session using similar save and load function:
, the local session will store data in local.msession file in you current project root directory and set current session name to __local.
Import and export projects
You can import and export project msession files using
session.export( 'SessionName', 'TargetFilePath' )
session.import( 'SourceFilePath' )
session.import( 'SourceFilePath', 'SessionName' )
A file selection dialog will guide you to select the proper file to load or save. The imported session will be copied in local machine user directory.
Note that import and export works only on your local machine.
Similar to import, linking an external session file simplying declare a session in local machine directory as virtual link, redirecting any operation (like save/load) to the linked session file. This permits you to save your msession file where you really want and update it directly without exporting it every time.
session.linkA useful way to use it is linking a local session to a global session to speed up your productivity simplying using local function but guarantee a global way to open you project maintaining you session file updated
session.link( 'SourceFilePath' )
session.link( 'SourceFilePath', 'SessionName' )
session.saveherefurther you may update your startup.m file
session.link( 'local.msession', 'GlobalName' )
...and you finish.m accordly
out = session.utils.folder
Displays local machine folder where sessions are saved
out = session.current
Displays current session name.
out = session.utils.list
List all local machine available sessions. If an output argument is provided, the function return a cell array with all session names, otherwise the list is displayed in console.
Save current session and exit
This is a list of features not yet coded, but eventually will be included in future releases of this small toolbox:
- Import and export sessions among different machines with different paths
- Import/export the complete project as compressed files with all the related files within
- More options!
Please contact me at firstname.lastname@example.org for bugs, info or interesting debate about space-time continuum.