[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: clear all variables except specific ones
From: |
Mike Miller |
Subject: |
Re: clear all variables except specific ones |
Date: |
Mon, 14 Aug 2017 11:53:32 -0700 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
On Sat, Aug 12, 2017 at 06:30:29 -0700, dariodematties wrote:
> How can I clear all variables except a specific subset from them?
Probably a couple ways. Here is how you can get a cell array of names of
variables in your workspace:
v = whos;
names = {v.name};
or the uglier shortcut
names = {[whos].name};
From there you can iterate over the list of variable names and clear or
not clear each one.
You could also save the variables you like to a file, clear all, and
load the file back into your workspace.
--
mike
signature.asc
Description: PGP signature