Counting certain values from an array
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Vadim Tambovtsev
le 22 Sep 2016
Modifié(e) : Image Analyst
le 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 commentaires
Réponse acceptée
Image Analyst
le 22 Sep 2016
Try this:
numOnes = sum(r(:))
numZeros = numel(r) - numOnes
4 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!