How can compute sequential occurrence of elements in a vector
Mostrar comentarios más antiguos
I would like to compute the number of each sequential sequence in a vector
for example i have x=[ 0 0 0 0 1 1 1 1 1 0 0 0 2 2 2 2 0 0 0 0 0 3 3 3 3 3 3]
So, I need to compute the lengths of the following sequences
[0 0 0 0 1 1 1 1 1]=9 ,
[0 0 0 2 2 2 2]=7,
[0 0 0 0 0 3 3 3 3 3 3]=11.
The expected result is [9 7 11].
Respuesta aceptada
Más respuestas (1)
hanadi abbas
el 7 de Mzo. de 2021
Editada: hanadi abbas
el 12 de Mzo. de 2021
0 votos
Categorías
Más información sobre Elementary Math en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!