Num2cell question
显示 更早的评论
I have a data of size 1440*720*102 double. I want to convert it into a cell structure, I used num2cell but I am hitting bricks !
回答(2 个)
Most probably too large for your computer:
A = rand(12,3,5)
A = num2cell(A)
1 个评论
A = rand(10);
C = num2cell(A);
whos A C
So the cell array, contining the same data, used considerably more memory (14x), to store those same elements.
11200/800
You have an array of size 1440*720*102. Assuming each element is a double, that is
1440*720*102*8/(1024^3)
So a little under 1 gigabyte of RAM, just to store that array. But, as a cell array, of individual elements, you might need as much as
1440*720*102*8/(1024^3)*14
11 gigabytes of RAM to store that cell array, IF you convert each element into one cell.
If you are being mroe efficient, and each cell is itslef more than one element, things might not be so inefficient. But you will still need something on the order of 11 gigabytes of free memory.
Image Analyst
2022-11-23
0 个投票
You say "cell structure" but it's ambiguous whether you want a structure array or a cell array.
Why on earth would you want to convert it to a cell array? Cell arrays take up way more memory than numerical arrays and are slower and more inefficient. I'd just leave your data as it is.
类别
在 帮助中心 和 File Exchange 中查找有关 Lengths and Angles 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!