Is there a function that lists all the available user-defined classes in MATLAB 7.8 (R2009a)?
21 views (last 30 days)
Show older comments
I am trying to list all the user-defined classes in MATLAB 7.8 (R2009a). The only method I see is to inspect the MATLAB PATH; however this will not list the classes defined in self contained files. I would like to know if there is a function that will list all the user-defined classes in MATLAB.
Accepted Answer
MathWorks Support Team
on 21 Jul 2009
There are no built-in functions to list all the user-defined classes in MATLAB 7.8 (R2009a).
As a workaround, to specifically deal with classes defined in self-contained files, perform the following steps:
1. Create a self-contained class in your directory
2. At the MATLAB command prompt execute:
s = what
The structure s contains information about @ type of directories and all the MATLAB program files are listed in the field s.m.
Assuming that, your class MATLAB file is listed at position 1, then executing the following code, is going to return 'false' for all classes and true for all regular MATLAB files.
str = s.m{1}
isempty(meta.class.fromName(str(1:end-2)))
Carry out this operation in all user directories on the MATLAB path as well as their sub-directories except the @ and + directories.
0 Comments
More Answers (0)
See Also
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!