how to count no of zeros between ones
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
PRIYAM DEKA
le 9 Juil 2021
Modifié(e) : Matt J
le 9 Juil 2021
suppose my array is
a=[0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0]
output i want is
[2 4 4 1 2]
0 commentaires
Réponse acceptée
Walter Roberson
le 9 Juil 2021
a=[0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0]
starts = strfind([1 a], [1 0])
stops = strfind([a 1], [0 1])+1
stops - starts
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!