if command for finding more than three identical numbers in a variable
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
hi, I need an if condition with the following command. if there are more than three consecutive identical numbers in this matrix then give me an ok signal if not then give me a false signal.
example:
v=[8,8,8,9,5,5,8,8,1];
if there are more than 3 consecutive identical numbers in v (8,8,8) then give me an ok signal otherwise give me a false signal
How can I translate the above command into a matlab command. any kind is appreciated. thanks
1 comentario
the cyclist
el 29 de Abr. de 2015
Do you need 3 or more consecutive, or more than 3 consecutive?
Respuestas (3)
the cyclist
el 29 de Abr. de 2015
Editada: the cyclist
el 29 de Abr. de 2015
Roger Stafford
el 29 de Abr. de 2015
Editada: Roger Stafford
el 29 de Abr. de 2015
You can devise your own test:
if any(diff([0,find(diff(v)~=0),size(v,2)])>3)
...
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!