Contents Previous Next Subchapters

Rounding of to the Nearest Integer Value
Syntax round(x)
See Also roundoff , ceil , floor , int , mod

Returns the element-by-element closest integer value to x where x is an integer, real, double-precision, or complex matrix. In the complex case, the round function applies to the real and imaginary parts separately.

     y = [ -1.4, -.6, 1.4, 2.] 
     [-1 , -1 , 1 , 2]

Note that round returns a matrix the elements of which are equal to integers, but the return value has the same type as x. The function roundoff returns a matrix that has the integer type.

In Mlmode , x can also be a logical, or character matrix.