Clearing variables using a list of variable names

5 次查看(过去 30 天)
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

采纳的回答

Omar Mian
Omar Mian 2011-12-9
Just realised it was as simple as doing:
clear(varlist{:})

更多回答(0 个)

类别

Help CenterFile 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!

Translated by