How to add a large number of cell.
1 次查看(过去 30 天)
显示 更早的评论
i have 3000 cell and each cell have size of 4*10^5.I want to add all cell in a single array of order (1,12*10^8).
0 个评论
采纳的回答
更多回答(1 个)
KSSV
2018-8-27
Read about cell2mat and _sum)
A{1} = rand(2,1) ;
A{2} = rand(2,1) ;
A{3} = rand(2,1) ;
B = cell2mat(A) ;
sum(B)
You can achieve the above in many ways. Like using loop or cellfun.
2 个评论
Amir Xz
2018-8-27
If you use default class (double), so you need 8.94 GB memory!
64*(12*10^8)/(8*2^30) = 8.9407 GB
So, change the class if that's OK.
Use the same name for your variables and ...
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!