How to get Data type of workspace loaded variables and how add that datatypes using script?

조회 수: 4 (최근 30일)
I have a .m files in that file many variales are created and loaded in workspace also but i want to add all the datatypes as bytes. can you tell me how to do?
Like uint8 as 1byte
uint16 as 2 byte so totally 3 bytes.
Thanks in advance.
  댓글 수: 6
Steven Lord
Steven Lord 2021년 4월 16일
Okay, let's say for sake of argument that the sizes of the various properties added up to 420 bytes.
Why is that important? How are you going to use that information?

댓글을 달려면 로그인하십시오.

답변 (1개)

Xingwang Yong
Xingwang Yong 2021년 4월 13일
s=whos;
numBytes = sum([s.bytes]);
  댓글 수: 14
Stephen23
Stephen23 2021년 4월 15일
You are only counting the number of bytes in the object handle. If you want to count the bytes in all attributes/properties of the object itself, then try one of the methods outlined in the links I showed you.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by