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