Which is the shortest way to count elements in the set of vector components?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
v = [1,3,4,1,2,2,1,2,3,2,2,2,1,4]
I would like to count the twos.
I have this ugly solution:
length(v(v==2))
are there any shorter solution?
0 Commenti
Risposta accettata
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!