MATLAB State

Saves and restores the MATLAB State (e.g. editor files, breakpoints, figures, variables, etc.)
649 Downloads
Updated 26 Jun 2013

View License

This script is designed to to save and restore the working state of MATLAB. This has only been tested on MATLAB version R2007a to R2011a, and it uses some undocumented features of MATLAB and might not work correctly for other versions.

When this script is called with the 'save' flag, it will ask for a location and file name to save the MATLAB state to. It will then proceed to save the current working directory, additional paths that differ from MATLAB root, open editor files, debug break points, open figures, base workspace variables, and command window history (this is not the same as the command history).

When this script is called with the 'restore' flag, it will open and GUI asking for the mState file to restore the MATLAB state from. All editor windows will then be closed, all debug break points will be removed, the command window will be cleared, all open figures will be closed, and all base workspace variables will be deleted before restoring the state. The script will then restore from the mState file the current working directory, addition paths other than MATLAB root, open editor windows, debug break points, open figures, base workspace variables, and commend window text history.

Cite As

Troy Grossarth (2024). MATLAB State (https://www.mathworks.com/matlabcentral/fileexchange/37486-matlab-state), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Workspace Variables and MAT-Files in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.5.0.0

Fixed an error that was caused by saving the MATLAB state when the editor was closed.

1.0.0.0