How do I find non zero cells in a cell array?

53 次查看(过去 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
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
pietro 2014-11-2
Here an axample:
testcell={0,1,1,0,1};
matcell=cell2mat(testcell);
find(matcell==0)

更多回答(1 个)

Azzi Abdelmalek
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]

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by