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

90 ビュー (過去 30 日間)
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019 年 9 月 5 日
回答済み: James Tursa 2019 年 9 月 5 日
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'.

採用された回答

madhan ravi
madhan ravi 2019 年 9 月 5 日
編集済み: madhan ravi 2019 年 9 月 5 日

その他の回答 (2 件)

Walter Roberson
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.

James Tursa
James Tursa 2019 年 9 月 5 日

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by