Find empty cells in 3D cell?
Show older comments
I have a 3D cell RowXColXDep (12X125X1216), I want to find the empty cells (which row, column, and depth). I used:
[Row Col Dep] = find(cellfun(@isempty,channelResp));
but it did not work, it works only for 2D cells. Is there a solution for 3D cells?
Thanks in advance
Accepted Answer
More Answers (1)
>> A = repmat({NaN},12,125,1216);
>> A(5,23,[2,4,8]) = {[]}; % empty
Then all you need is this:
>> [R,C,P] = ind2sub(size(A),find(cellfun('isempty',A)))
R =
5
5
5
C =
23
23
23
P =
2
4
8
1 Comment
Walter Roberson
on 3 Oct 2019
This is the better answer.
Categories
Find more on Matrix Indexing 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!