How do I find non zero cells in a cell array?
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Iddo Weiner
am 2 Nov. 2014
Kommentiert: Guillaume
am 2 Nov. 2014
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 Kommentar
Guillaume
am 2 Nov. 2014
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.
Akzeptierte Antwort
pietro
am 2 Nov. 2014
Here an axample:
testcell={0,1,1,0,1};
matcell=cell2mat(testcell);
find(matcell==0)
0 Kommentare
Weitere Antworten (1)
Azzi Abdelmalek
am 2 Nov. 2014
Bearbeitet: Azzi Abdelmalek
am 2 Nov. 2014
a={1 1 0 0 1;0 0 1 1 1}
[row,col]=find(cell2mat(a))
out=[row col]
0 Kommentare
Siehe auch
Kategorien
Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!