Effacer les filtres
Effacer les filtres

function similar to count

6 vues (au cours des 30 derniers jours)
SSG_newbiecoder
SSG_newbiecoder le 26 Déc 2017
Commenté : SSG_newbiecoder le 26 Déc 2017
Is there any function similar to count that can be used in an array of 1's,-1's and 0's to count the number of 1's present in a particular range?
  1 commentaire
Birdman
Birdman le 26 Déc 2017
Check my answer.

Connectez-vous pour commenter.

Réponse acceptée

Birdman
Birdman le 26 Déc 2017
One approach:
A=randi([-1 1],1,100);%random data for -1,0 and 1
cnt=sum(ismember(A,1));%counts the number of 1 in array A
  1 commentaire
SSG_newbiecoder
SSG_newbiecoder le 26 Déc 2017
Thank you :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices 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!

Translated by