How can a logical vector be converted to a numeric vector in which the values represent the number of zeros between ones?
Mostra commenti meno recenti
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 Commento
Walter Roberson
il 10 Nov 2016
Please explain further how you get that y from that x ?
Risposta accettata
Più risposte (1)
Robert
il 7 Dic 2016
0 voti
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!