roundn - Round to multiple of 10n
Syntax
roundn(x,n)
Description
roundn(x,n) rounds each
element of x to the nearest multiple of 10n. n must
be scalar, and integer-valued. For complex x, the
imaginary and real parts are rounded independently. For n
= 0, roundn gives the same result
as round. That is, roundn(x,0) == round(x).
Examples
Round pi to the nearest hundredth.
roundn(pi, -2)
ans =
3.1400
Round the equatorial radius of the Earth, 6378137 meters, to
the nearest kilometer.
roundn(6378137, 3)
ans =
6378000See Also
round
 | rotatetext | | rsphere |  |
Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
Get the Interactive Kit