rounding numbers in a specific values

4 ビュー (過去 30 日間)
Adel Emam
Adel Emam 2020 年 3 月 7 日
コメント済み: Adel Emam 2020 年 3 月 7 日
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

採用された回答

Guillaume
Guillaume 2020 年 3 月 7 日
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 =
10.5
  1 件のコメント
Adel Emam
Adel Emam 2020 年 3 月 7 日
thanks you alot . i appreciate that

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by