hi, I want raounded a number, so I read this link about that http://www.mathworks.com/matlabcentral/answers/37262 But in this case , it rounde any no. ,while I want rounde number meet a condition. for example:
0.2371 be 0.2400
0.4546 be 0.4600
but this number 0.2330 , must be not equal 0.2400, must be the same i.e I want round number if the third digit after floating point equal or more than 5
Thanks in advance
No products are associated with this question.
sprintf('%.2f00', round(N * 100) / 100)
Though I admit to being puzzled as to why you want the misleading '00' at the end, why you want 0.2400 instead of 0.24
If you want it just for displaying, what about:
sprintf('%.3f\n', [0.2371, 0.4546])
I'd definitly omit the trilaing zero, because it is not only confusing, but wrong.