Find 625 consecutive ones in vector
Mostrar comentarios más antiguos
Hello,
I have a 45000x1 rowvector, which contains only 1's and 0's. I want to find the periods of 625 consecutive ones and locations of these 1's in this vector. Can anyone help?
Thank you.
2 comentarios
Sean de Wolski
el 24 de Mzo. de 2020
Editada: Sean de Wolski
el 24 de Mzo. de 2020
Exactly 625 or >=625?
John D'Errico
el 24 de Mzo. de 2020
Editada: John D'Errico
el 24 de Mzo. de 2020
As Sean points out, the difference might change how one solves the problem. Do you want to find ALL occurrences of exactly 625 ones? What if there is a string of length 626? Does that correspond to two sustrings of length 625, one starting one element further down the line? Or is that just one string, that happens to satisfy the goal? What if there was a string of length 1250? Is that two consecutive strings of length 625? Or is it 625 strings of length 625 that overlap, or is it just one string?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!