Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Time Series in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by