how can i calculate how many number of times that 1 occurs.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
vetri veeran
le 13 Déc 2014
Modifié(e) : Azzi Abdelmalek
le 13 Déc 2014
I have an array like this
x =
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
how can i calculate how many number of times that 1 occurs.
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 13 Déc 2014
Modifié(e) : Azzi Abdelmalek
le 13 Déc 2014
x=repmat(1:4,4,1) % Example
out=sum(x(:)==1)
%or
out=nnz(x==1)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Multidimensional Arrays 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!