Counting certain values from an array
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Vadim Tambovtsev
am 22 Sep. 2016
Bearbeitet: Image Analyst
am 22 Sep. 2016
Suppose we have an array r=(2,2,2) filled with zeros and ones. How to count up how many zeros and how many ones do we have?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 22 Sep. 2016
Try this:
numOnes = sum(r(:))
numZeros = numel(r) - numOnes
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differential Equations 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!