Determining unique abbreviations in a dataset
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a dataset in the char format. For example
RPG
RTS
RTS
GBA
PSP
PS3
XBX
TBS
FFS
would be 8.
Is there a function I can use to return the number of unique abbreviations in the dataset. I have tried length(unique(x)), but that did not return the correct answer.
2 commentaires
Walter Roberson
le 8 Fév 2013
Watch out -- length() of a 1x2 vector of char would be 2 whereas you would be wanting 1 in the case there was only a single unique state in the list. size() is better for this.
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 8 Fév 2013
s=['AK';'AZ';'CA';'CA';'IL';'ID';'ID';'MS';'NH']
out=unique(s,'rows')
0 commentaires
Voir également
Catégories
En savoir plus sur Shifting and Sorting 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!