How can I create a new vector using the if function?
Mostrar comentarios más antiguos
Hi everyone,
I have the following problem:
I have a vector (V) that range from 0 to 60 and I would like to group these data as following:
* If the value of (V) is between or equal to 0 and 5 , give me 5
* If the value of (V) is between or equal to 6 and 10 , give me 10
...
* If the value of (V) is between or equal to 56 and 60 , give me 60
The vector V contains 60 data, and the new vector should contain also 60 data
Thank you in advance
Respuesta aceptada
Más respuestas (1)
the cyclist
el 4 de Jun. de 2016
ceil(V/5) * 5
2 comentarios
John D'Errico
el 4 de Jun. de 2016
This misses the 0 case.
the cyclist
el 4 de Jun. de 2016
Yep
Categorías
Más información sobre Loops and Conditional Statements 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!