Determining unique abbreviations in a dataset
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Walter Roberson
2013 年 2 月 8 日
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.
採用された回答
その他の回答 (1 件)
Azzi Abdelmalek
2013 年 2 月 8 日
s=['AK';'AZ';'CA';'CA';'IL';'ID';'ID';'MS';'NH']
out=unique(s,'rows')
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Shifting and Sorting Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!