Clearing variables using a list of variable names

조회 수: 17 (최근 30일)
Omar Mian
Omar Mian 2011년 12월 9일
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에서 Whos에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by