How to Clear all Variables of a Workspace Except for Those Explicitly Excluded?
137 views (last 30 days)
Show older comments
Rightia Rollmann on 15 Mar 2017
How do I clear all variables of a workspace except for those that I explicitly mention not to be cleared?
Jan on 15 Mar 2017
Edited: Jan on 15 Mar 2017
See doc clearvars:
clearvars -except keepVariables
I recommend to use functions. Then there is no need to clear workspace variables. For larger projects it is very useful, if the workspace is kept clean, instead of applying method to clean them manually.
More Answers (1)
ES on 15 Mar 2017
Find more on Workspace Variables and MAT-Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!