How can a logical vector be converted to a numeric vector in which the values represent the number of zeros between ones?
Afficher commentaires plus anciens
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 commentaire
Walter Roberson
le 10 Nov 2016
Please explain further how you get that y from that x ?
Réponse acceptée
Plus de réponses (1)
Robert
le 7 Déc 2016
0 votes
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!