How can a logical vector be converted to a numeric vector in which the values represent the number of zeros between ones?
Mostrar comentarios más antiguos
I am searching for a simple way to convert a logical vector, to a vector in which the values represent the total number scalars between ones, and including the first 1 in the list. Essentially converting x to y where:
x = [1;1;1;0;0;1;0;1];
y = [1;1;3;3;3;2;2;1];
Any suggestions? Thanks!
RTT
1 comentario
Walter Roberson
el 10 de Nov. de 2016
Please explain further how you get that y from that x ?
Respuesta aceptada
Más respuestas (1)
Robert
el 7 de Dic. de 2016
0 votos
Categorías
Más información sobre Creating and Concatenating Matrices 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!