how to count number of states in sequence?

2 visualizaciones (últimos 30 días)
Ram k
Ram k el 5 de Mayo de 2016
Editada: Azzi Abdelmalek el 5 de Mayo de 2016
Suppose I have a sequence 1,3,3,1,2,1,4,2,3,1,4,2,4,4,4,3,1,2,5,1 in this 5 states are there, so how to count that there are 5 states.

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 5 de Mayo de 2016
Editada: Azzi Abdelmalek el 5 de Mayo de 2016
a=[1,3,3,1,2,1,4,2,3,1,4,2,4,4,4,3,1,2,5,1]
out=unique(a)
number_of_states=numel(out)

Community Treasure Hunt

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

Start Hunting!

Translated by