Extract 3D cells with nonzero elements, from a 3D cell array.
古いコメントを表示
Hi guys! I have binary masks saved in 3D arrays (e.g. Mask(:,:,40), see attached Matlab file) and I want to extract only the 3D cell arrays which contain nonzero elements in a sequential order (e.g. if these are 20, then NMask(:,:,20)). Any ideas would be much appreciated.
1 件のコメント
Stephen23
2016 年 9 月 12 日
See Guillaume's answer for a much simpler solution.
採用された回答
その他の回答 (1 件)
Guillaume
2016 年 9 月 12 日
Well, if you want nice and concise:
filteredmask = Combinedmask(:, :, any(any(Combinedmask, 1), 2))
No need for cell arrays, loops, ifs, etc., just one line.
カテゴリ
ヘルプ センター および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!