How do I find non zero cells in a cell array?
조회 수: 16 (최근 30일)
이전 댓글 표시
Let's say I have a 100x10 cell array of 0 and 1 (false and true). I want to know which cells contain 1's. I would like the information to appear like this: (row number,column numer). Thank you!
댓글 수: 1
Guillaume
2014년 11월 2일
If each cell of the cell array is a single number, why do you use a cell array in the first place?
A plain matrix would be much better.
채택된 답변
pietro
2014년 11월 2일
Here an axample:
testcell={0,1,1,0,1};
matcell=cell2mat(testcell);
find(matcell==0)
댓글 수: 0
추가 답변 (1개)
Azzi Abdelmalek
2014년 11월 2일
편집: Azzi Abdelmalek
2014년 11월 2일
a={1 1 0 0 1;0 0 1 1 1}
[row,col]=find(cell2mat(a))
out=[row col]
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!