Mapping Toolbox | ![]() ![]() |
Round numbers at specified powers of 10
Syntax
Description
outnum = roundn(innum) rounds the elements of innum
to the nearest one-hundredth.
outnum = roundn(innum,n) specifies the power of 10 to which the elements of innum
are rounded. For example, if n = 2
, round to the nearest hundred (102).
Examples
Using generated numbers, round them to significant tenths, ones, and tens figures (note that your original numbers could differ):
fullfig = 1000*magic(2)/7 fullfig = 142.8571 428.5714 571.4286 285.7143 tenths = roundn(fullfig,-1) tenths = 142.9000 428.6000 571.4000 285.7000 units = roundn(fullfig,0) units = 143 429 571 286 tens = roundn(fullfig,1) tens = 140 430 570 290
See Also
epsm |
Map precision |
![]() | rotatetext | rsphere | ![]() |