Borrar filtros
Borrar filtros

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

3 visualizaciones (últimos 30 días)
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

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Time Series en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by