how can I count the number of elements on a vector?
Afficher commentaires plus anciens
Hello!!!!!
If I have a column lets imagine T=[105;105;105;106;106;106;107;107;107;107] how can I count the number of different elements in T? in this case 105 is 3 times, 106 appears 3 times and 107 is 4 times in T.
Thanks!!!
Réponse acceptée
Plus de réponses (1)
Ahmet Cecen
le 7 Mai 2016
Modifié(e) : Ahmet Cecen
le 7 Mai 2016
[C,ia,ic] = unique(T);
c = hist(ic,1:max(ic));
CountArray = [T(ia) c'];
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!