How do I detect if the input number is within a certain range?

1 visualización (últimos 30 días)
How do I detect the upper and lower limit of a number if the input is within a certain range?
For example:
input_Num = 3371;
i = 20000:-2500:2500;
How do code so that I am able determine within which range of i is input_Num? Which in this case, the upper is 5000 and lower is 2500.
Thank you very much!

Respuesta aceptada

David Hill
David Hill el 28 de Feb. de 2022
f=floor(input_Num/2500);
lower=f*2500;
upper=(f+1)*2500;

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by