Counting elements in cell array
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
tinkiewinkie
le 24 Juin 2020
Réponse apportée : Rohith Nomula
le 24 Juin 2020
Hi suppose I have a column of different label of ant, cat, dog and fish formatted as cell in matlab, how do I count how many "ant", "dog","cat" and "fish" are there in total in the cell column?
0 commentaires
Réponse acceptée
Plus de réponses (1)
Rohith Nomula
le 24 Juin 2020
You can try this for a specific column of a cell array
Suppose in the 2nd column you have elements
labels=NameofYourCellArray(:,2);
nnz(ismember(labels,'dog'))
This gives you count of all the labels name 'dog' in a specific column
0 commentaires
Voir également
Catégories
En savoir plus sur Particle Swarm 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!