フィルターのクリア

How can I count the number of vector elements without repetition?

3 ビュー (過去 30 日間)
Hadeer Mostafa
Hadeer Mostafa 2016 年 11 月 11 日
回答済み: dpb 2016 年 11 月 11 日
Hi, I have a vector that contains repeated elements, How can I count the number of vector elements without repetition?
For example: a=[2 5 2 8 9 8 7 8 1]; I expect the result will be: count = 6

採用された回答

dpb
dpb 2016 年 11 月 11 日
>> na=[2 5 2 8 9 8 7 8 1];
>> length(unique(na))
ans =
6
>>

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTime Series についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by