Azzera filtri
Azzera filtri

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

51 visualizzazioni (ultimi 30 giorni)
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'.

Risposta accettata

madhan ravi
madhan ravi il 5 Set 2019
Modificato: madhan ravi il 5 Set 2019

Più risposte (2)

Walter Roberson
Walter Roberson il 5 Set 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.

James Tursa
James Tursa il 5 Set 2019

Categorie

Scopri di più su Workspace Variables and MAT-Files in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by