File Exchange

image thumbnail

nclear

version 1.0 (1.44 KB) by

Clear all the other variables from the callers workspace except the specified ones.

1 Download

Updated

View License

Clear all the other variables from the callers workspace except the specified ones.

Useful when you have a lot of variables in the workspace and only want to keep a few of them and clear all the others.

%NCLEAR Clear all the other variables from the caller's workspace except the specified ones.
% NCLEAR(VAR1,VAR2,....) clears all the other variables except VAR1,VAR2,...
% NCLEAR('VAR1','VAR2',...) clears all the other variables except VAR1,VAR2,...
% NCLEAR() clears all the variables, save as CLEAR

Comments and Ratings (1)

someone

Yet another variation of clearex, keep2, keep3, etc already posted on the MATLAB FEX.

note: r2008a (finally) introduces CLEARVARS with these options

clearvars -except v1 v2 ...
clearvars -except -regexp p1 p2 ...
clearvars v1 v2 ... -except -regexp p1 p2 ...
clearvars -regexp p1 p2 ... -except v1 v2 ...

MATLAB Release
MATLAB 7.8 (R2009a)
Tags Add Tags

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video