Rounding a decimal down
조회 수: 4(최근 30일)
표시 이전 댓글
With round(x,2) I can round a number to the nearest hundredth, but how do I round down to the nearest hundredth? For example, both 0.143 and 0.147 should become 0.14.
댓글 수: 0
채택된 답변
추가 답변(2개)
Vilém Frynta
2022년 12월 2일
편집: Vilém Frynta
2022년 12월 2일
Example:
X = 0.143;
Y = sprintf('%.2f',X);
Y = str2double(Y)
댓글 수: 2
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!