How to round up and down a value close to multiple of 5?

25 visualizaciones (últimos 30 días)
Debu Patil
Debu Patil el 9 de Mzo. de 2016
Comentada: Robert Scott el 10 de Dic. de 2023
V=148.559 how to get answer by rounding up to multiple of 5 V=150 how to get answer by rounding down to multiple of 5 V=145
  2 comentarios
Debu Patil
Debu Patil el 19 de Mzo. de 2016
Thanks for the answer. It is useful to me. I struggled lot for this. Thank you.
Stephen23
Stephen23 el 19 de Mzo. de 2016
Editada: Stephen23 el 19 de Mzo. de 2016
@Debu Patil: my pleasure!.

Iniciar sesión para comentar.

Respuesta aceptada

Stephen23
Stephen23 el 9 de Mzo. de 2016
Editada: Stephen23 el 9 de Mzo. de 2016
>> V=148.559;
>> 5*floor(V/5)
ans = 145
>> 5*ceil(V/5)
ans = 150

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by