How to measure the real size of a variable in workspace?

44 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2019 年 7 月 25 日
回答済み: MathWorks Support Team 2019 年 7 月 25 日
How to measure the real size of a variable in workspace?
When using handle objects I only see 8 Bytes while using the command 'whos'.

採用された回答

MathWorks Support Team
MathWorks Support Team 2019 年 7 月 25 日
You only see 8 Bytes while using 'whos' because this is the size of the pointer as a reference to the handle object.
To evaluate the size of a variable with such a reference, please use the command 'struct' onto this variable.
This produces a minimal overhead to the real size, but doing this you can figure out the order of magnitude of the variable.
This means image you have a variable called 'a' which shows only 8 Byte via 'whos', then do the following:
>> b = struct(a);
If you use 'whos' right now, you will see a better scale of the size of 'a' in variable 'b'.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by