How do I find non zero cells in a cell array?
102 ビュー (過去 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 件のコメント
参考
カテゴリ
Find more on Logical 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!