FUNCTION REFERENCE

fix

Round toward zero.

Round toward zero.

Syntax

fix(X)

Truncates each real value toward zero. For complex values, truncates the real and imaginary parts separately. Logical inputs convert to double.

Example

fix([-2.5 -1.5 -0.5 0.5 1.5 2.5])   % [-2 -1 -0 0 1 2]

Differences from MATLAB: Only 2-D arrays are supported. Complex results with zero imaginary parts are real.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.