How to access data in a cell array?
3 ビュー (過去 30 日間)
表示 古いコメント
Hi,
I have an 40*8 cell array, called Q. Each cell contains an 64×64×128 double matrix.

I would like to have a foor loop on the 3rd dimension of each matrix in these cells. How can I do that? Thanks!
回答 (1 件)
Walter Roberson
2021 年 2 月 9 日
mask = ~cellfun(@isempty, Q);
results = cell(size(Q));
results(mask) = cellfun(@(C) DO_SOMETHING_3D(C), Q(mask), 'uniform', 0);
For example,
mask = ~cellfun(@isempty, Q);
results = cell(size(Q));
results(mask) = cellfun(@(C) sum(C, 3), Q(mask), 'uniform', 0);
参考
カテゴリ
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!