Effacer les filtres
Effacer les filtres

rounding numbers in a specific values

1 vue (au cours des 30 derniers jours)
Adel Emam
Adel Emam le 7 Mar 2020
Commenté : Adel Emam le 7 Mar 2020
By having this number Num=10.25
and It's wanted to round it to 10.5
What function should be used to round 10.25 to 10.5 ?
Thanks in advance

Réponse acceptée

Guillaume le 7 Mar 2020
multiply by 2, round to the nearest integer, divide back by 2 => round to the nearest 1/2:
>> Num = 10.25;
>> round(Num*2)/2
ans =
  1 commentaire
Adel Emam
Adel Emam le 7 Mar 2020
thanks you alot . i appreciate that

Connectez-vous pour commenter.

Plus de réponses (0)


Community Treasure Hunt

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

Start Hunting!

Translated by