Keeps specified variables and figures, and clears/closes all remaining. Also clears command window.


Updated 25 Oct 2004

View License

Inspired by the usefulness of KEEP-series utilities (original KEEP by David Yang, KEEP2 by Mark Lubinski, KEEP3 by Martin Barugel) I created a simple utility which I find useful. FRESH does what KEEP3 does with variables (keeps only the ones you specify, clears the rest), and also does this with figures. As a finishing touch, it clears the command window, giving you the "fresh start" in your MATLAB session.

Requires that you also have KEEP3.M in your search path (which you can download from this website). IMPORTANT: On my system I renamed KEEP3.M to KEEP.M, and this is what FRESH assumes. If your copy is named KEEP3.M, just run a quick search-and-replace to substitute KEEP --> KEEP3 to make FRESH work properly.

If anyone can improve this utility, please feel free to do so.

Cite As

Pawel Mroszczyk (2023). FRESH (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Performance and Memory 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