Can you use the whos command to identify classes
이전 댓글 표시
As the title says, I'm wondering if the whos command (or an equivilent) could be used to get the range and storage requirements on a class in Matlab. For example, the 'double' class ranges from -10^308 to 10^308 amd needs 8 bytes of storage. How would I get these specs for, say, int8? Lookng on the wiki https://www.mathworks.com/help/matlab/matlab_prog/fundamental-matlab-classes.html does not give this information, so can it be obtained with a script? Thanks
채택된 답변
추가 답변 (2개)
Try this:
a=uint8([1,2,3]);
dbl = 123.456;
str = 'abc';
s = whos
t = struct2table(s)
댓글 수: 3
Anthony Koning
2022년 10월 4일
Image Analyst
2022년 10월 5일
Did you mean a class definition or an instance of a class. Of course a class definition is just a definition of a framework that could contain variables (properties). So you can't get a size of that. However an instance of a class is a variable and you can get the size it uses up with the whos command like I showed.
Image Analyst
2022년 10월 5일
OK I see what you want now, now that I see Walter's answer which you accepted. Of course Walter has the advantage of having the Mind Reading Toolbox, which I don't have yet.
You wanted the range of built-in classes like uint8, double, etc. I thought you wanted classes like classes you made yourself with the classdef command (like my attached Excel utility class), or instances of those classes (actual variables you instantiated as being an instance of the class) or instances of built-in class variables.
Steven Lord
2022년 10월 5일
0 개 추천
카테고리
도움말 센터 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!