why my empty cell array taking 104 bytes instead of 112 bytes..?
1 回表示 (過去 30 日間)
古いコメントを表示
OMKARAM RAJESHWARA RAJU
2020 年 9 月 6 日
編集済み: Walter Roberson
2020 年 9 月 6 日
Hello,
it is mentioned in the document that,
an empty cell array will take
30 bytes for 32 bit systems
& 112 bytes for 64 bit systems.
i got confused why my 64 bit system is taking 104 bytes of memory for an empty cell array..
can someone please explain me..?
Thanks in advance ..!
2 件のコメント
採用された回答
Bruno Luong
2020 年 9 月 6 日
編集済み: Bruno Luong
2020 年 9 月 6 日
A = {[]}
is NOT an empty cell, it's 1 x 1 cell contains an empty array.
An empty cell is
A = {}
3 件のコメント
Bruno Luong
2020 年 9 月 6 日
編集済み: Bruno Luong
2020 年 9 月 6 日
Sorry, I can't answer you.
I don't know what whos command exactly display for BYTES or the internal mechanism when CELL or {} command is invoked.
Bruno Luong
2020 年 9 月 6 日
編集済み: Bruno Luong
2020 年 9 月 6 日
I read the doc and test on 2 MATLAB versions 2018b and 2020a. The 112 bytes of header size seems to be applicable to R2018b and 104 bytes for 2020a
R2018b
>> A={[]}
A =
1×1 cell array
{0×0 double}
>> whos
Name Size Bytes Class Attributes
A 1x1 112 cell
And R2020a
>> A={[]}
A =
1×1 cell array
{0×0 double}
>> whos
Name Size Bytes Class Attributes
A 1x1 104 cell
その他の回答 (1 件)
Image Analyst
2020 年 9 月 6 日
Cell arrays take a huge amount of overhead. Don't use them unless you have to, which means you'll have different kinds of variables in each cell. Otherwise use a double array if they're all numbers, or a table if it's a mixture of variable classes (e.g. strings and numbers) but each column will be all of the same class.
See the very first item on the FAQ: What is a cell array?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Type Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!