How to figure out the number of objects in a workspace?
Ältere Kommentare anzeigen
I have taken the workspace function whos and assigned it to variable obj. How do I then find the number of objects in the workspace?
I have:
obj = evalin('base','whos');
%then I go into a loop
count=0;
while(true)
count=count+1;
something=obj(count).class;
%do something
end
Is there a way to find length or sizof obj.class?
Akzeptierte Antwort
Weitere Antworten (1)
Arnaud Miege
am 9 Aug. 2011
0 Stimmen
How about length(obj)? Note that this will include obj itself, so you may want to subtract 1.
Arnaud
2 Kommentare
Stagleton
am 9 Aug. 2011
Arnaud Miege
am 9 Aug. 2011
I don't think you need obj.class. length(obj) with give you the number of object in the workspace + obj itself.
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!