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일

0 개 추천

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

질문:

2020년 3월 7일

댓글:

2020년 3월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by