Similarly, is there a way to generate a list of the user-defined classes currently loaded into memory?
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"
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.
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
Take a look at the INMEM function.
--
Steve Lord
sl...@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
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.
> 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.