Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to clear all variables except one or two
Date: Sun, 1 Feb 2009 00:37:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 3
Message-ID: <gm2qrd$r1$1@fred.mathworks.com>
References: <gm2nh1$4hu$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1233448621 865 172.30.248.37 (1 Feb 2009 00:37:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 1 Feb 2009 00:37:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1551459
Xref: news.mathworks.com comp.soft-sys.matlab:515194


Actually I found a way that can be done easily, this for anyone out there needing this info,

clearvars -except v1 v2 ... clears all variables except for those specified following the -except flag. Use the wildcard character '*' in a variable name to exclude variables that match a pattern from being cleared. clearvars -except X* clears all the variables in the current workspace, except for those that start with X, for instance.