Is it possible to 'clear all' variables except one?
79 次查看(过去 30 天)
显示 更早的评论
I am using clear all command. But I wan to keep just one of the varibles. Lets say the name of that variable is 'var'.
0 个评论
采纳的回答
更多回答(2 个)
Walter Roberson
2019-9-5
No, that is not possible using "clear all"
The only time you should ever use "clear all" is if you are deliberately resetting your entire MATLAB session. If it would not be acceptable to quit and re-enter MATLAB at that point then you should not use "clear all"
You should have a look at the clearvars() command, which does have an -except option.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!