Products & Services Solutions Academia Support User Community Company

Learn more about Mapping Toolbox   

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 =

     6378000

See Also

round

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS