How can you iterate over a vector
Afficher commentaires plus anciens
I have this vector that I'm trying to iterate over and have a running count for specific elements. I thought about doing this with indexing as well like "find(diff([arr; -1]" as another example. How can I do this so I get this output for this sample array:
arr = [0; 0; 0; 1; 1; 1; 0];
tokenizeSignal(arr)
ans =
3 0
3 1
1 0
A new row is made for each new token. It keeps a count of the number of 0s and 1s in the vector.
1 commentaire
dpb
le 6 Nov 2016
There's a runs-finding tool at File Exchange...
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical 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!