필터 지우기
필터 지우기

Find empty cells in 3D cell?

조회 수: 3 (최근 30일)
Sharif Khalil
Sharif Khalil 2019년 10월 2일
댓글: Walter Roberson 2019년 10월 3일
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

채택된 답변

Shubham Gupta
Shubham Gupta 2019년 10월 3일
Try this:
[r,c] = find(cellfun(@isempty,channelResp));
[nR,nC,nD] = size(channelResp);
Dep = floor(c/nC-0.0001)+1;
Col = c - nC*(Dep-1);
Row = r;
Let me know if you have doubts.
  댓글 수: 2
Sharif Khalil
Sharif Khalil 2019년 10월 3일
Thank you, it worked!
Shubham Gupta
Shubham Gupta 2019년 10월 3일
I am glad I could help. Please, make sure to accept the answer if it solves your problem. Cheers

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Stephen23
Stephen23 2019년 10월 3일
편집: Stephen23 2019년 10월 3일
The simple MATLAB solution is to use ind2sub. First lets create some fake data:
>> 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
Walter Roberson
Walter Roberson 2019년 10월 3일
This is the better answer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by