Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

clear classes

1 view
Skip to first unread message

Matt J

unread,
Dec 29, 2009, 1:16:04 PM12/29/09
to
Is there any way to clear specfic classes from memory, unlike "clear classes" which just wipes them all out?

Similarly, is there a way to generate a list of the user-defined classes currently loaded into memory?

ImageAnalyst

unread,
Dec 29, 2009, 1:43:18 PM12/29/09
to
The exist() function says it will check for classes.

ImageAnalyst

unread,
Dec 29, 2009, 1:47:22 PM12/29/09
to
On Dec 29, 1:43 pm, ImageAnalyst <imageanal...@mailinator.com> wrote:
> The exist() function says it will check for classes.

Like it says in the "Remarks" help for exist(), you can use "who" to
get all variables and classes and ismember() to narrow it down to ones
you're interested in. So check out the help for "who" and "whos"

Matt J

unread,
Dec 29, 2009, 2:28:02 PM12/29/09
to
ImageAnalyst <imagea...@mailinator.com> wrote in message <b66bc097-b544-4f10...@k19g2000yqc.googlegroups.com>...

That won't quite do it, unfortunately. I'm trying to detect the existence of "class definitions", not the existence of class objects. It is possible for a class definition to be loaded into MATLAB memory without an object of that class existing. In this case, whos/exist will not detect it.

us

unread,
Dec 29, 2009, 2:58:02 PM12/29/09
to
"Matt J " <mattja...@THISieee.spam> wrote in message <hhdl82$nog$1...@fred.mathworks.com>...

yes - and: most unfortunately -
- note: requires the curve fitting tbx

clear all; % !!!!! save old stuff !!!!!
m=cfit; % a useless CFIT O
figure('userdata',m);
whos;
% Name Size Bytes Class Attributes
% m 1x1 138 cfit
clear all;
whos;
% ...empty line...
n=get(gcf,'userdata');
whos;
% Name Size Bytes Class Attributes
% n 1x1 138 cfit

hence, if an object is embedded/put into any(!) container, it
- may be invisible to WHO/WHOS
- is NOT cleared by calls to CLEAR

just a thought...
us

Steven Lord

unread,
Dec 31, 2009, 8:56:24 PM12/31/09
to

"Matt J " <mattja...@THISieee.spam> wrote in message
news:hhdl82$nog$1...@fred.mathworks.com...

Take a look at the INMEM function.

--
Steve Lord
sl...@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


RjOllos

unread,
Jan 2, 2010, 11:25:35 PM1/2/10
to
On Dec 29 2009, 10:16 am, "Matt J " <mattjacREM...@THISieee.spam>
wrote:

> Is there any way to clear specfic classes from memory, unlike "clear classes" which just wipes them all out?

Seems that every follow-up was in regard to your second question,
however I quite frequently come across an issue that may be related to
your first question.

One particular behavior of `clear classes` that I don't like is that
it clears breakpoints in all files (as of r2009b).

While I haven't had the specific need to clear some classes and not
others (but would be interested to hear a use case for this), I would
definitely like to clear classes from memory without clearing
breakpoints.

Matt J

unread,
Jan 3, 2010, 9:22:04 PM1/3/10
to
RjOllos <ry...@physiosonics.com> wrote in message <bd3ea624-3f57-4016...@k17g2000yqh.googlegroups.com>...

> One particular behavior of `clear classes` that I don't like is that
> it clears breakpoints in all files (as of r2009b).

mlock() will prevent this, though admittedly, it is not a convenient measure.

> While I haven't had the specific need to clear some classes and not
> others (but would be interested to hear a use case for this),

I was pursuing this to overcome a limitation in my FEX namespace tool

http://www.mathworks.com/matlabcentral/fileexchange/26221-namespace-scoping-operator

Because I cannot clear classes selectively, I cannot use this tool to overcome name conflict between 2 classdef files of the same name.

0 new messages