Contents Previous Next Subchapters

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

Description
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.

Example
     y = [ -1.4, -.6, 1.4, 2.] 
     round(y)
returns
     [-1 , -1 , 1 , 2]

Reference
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.

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