MATLAB Answers

0

Is it possible to 'clear all' variables except one?

Asked by Zeynab Mousavikhamene on 5 Sep 2019
Latest activity Answered by James Tursa
on 5 Sep 2019
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 Comments

Sign in to comment.

Tags

3 Answers

Answer by madhan ravi
on 5 Sep 2019
Edited by madhan ravi
on 5 Sep 2019
 Accepted Answer

  0 Comments

Sign in to comment.


Answer by Walter Roberson
on 5 Sep 2019

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 Comments

Sign in to comment.


Answer by James Tursa
on 5 Sep 2019

  0 Comments

Sign in to comment.