Count number of cells separating two trues in logical vector
5 views (last 30 days)
Show older comments
Commented: Enrico Gambini on 12 Oct 2022
I would like to find a fast procedure to count the number of cells separating two trues in a logical vector, and store the results in a new numeric vector.
The output should be
output=[4;3;2]; % Hence, it counts also the "first" true
Hope the question is clear.
Matt J on 12 Oct 2022
More Answers (0)
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!