trunc

Purpose

Converts numbers to integers by truncating the fractional portion.

Format

y = trunc(x)
Parameters:x (NxK matrix or N-dimensional array) – data
Returns:y (NxK matrix or N-dimensional array) – containing the truncated elements of x.

Examples

x = 100*rndn(2, 2);
y = trunc(x);

If x equals:

-153.373  -1.972
 109.412 127.732

then, y will equal:

-153.000  -1.000
 109.000 127.000

See also

Functions ceil(), floor(), round()