How find non zero
Afficher commentaires plus anciens
Hello,
For example I have a vector A = [ 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0]. And I do find(A,2)-2, so I have the 2 zeros before the first one. However, how can I get the 5 zeros before the first one ? If i do find(A,5)-5 I will get only the 4 zeros because there is only four one.
Thank you.
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 6 Juin 2016
strfind(A, [0 0 0 0 0 1])
Catégories
En savoir plus sur MATLAB 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!