Filter löschen
Filter löschen

Clearing variables using a list of variable names

5 Ansichten (letzte 30 Tage)
Omar Mian
Omar Mian am 9 Dez. 2011
Hello,
I have a cell array called 'varlist' that contains the names of variables that I want to clear from the workspace. What is the most efficient way of clearing these variables?
At the moment I am doing
for idx = 1:length(varlist)
clear(varlist{idx})
end
Can this be accomplished without resorting to a loop?
Thanks

Akzeptierte Antwort

Omar Mian
Omar Mian am 9 Dez. 2011
Just realised it was as simple as doing:
clear(varlist{:})

Weitere Antworten (0)

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by