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

3 ビュー (過去 30 日間)
Dhinesh K
Dhinesh K 2021 年 4 月 13 日
コメント済み: Dhinesh K 2021 年 4 月 16 日
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?
Dhinesh K
Dhinesh K 2021 年 4 月 16 日
I need that info for my project. thats why

サインインしてコメントする。

回答 (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 Center および File ExchangeVariables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by