FUNCTION REFERENCE
sign
Sign of real values or direction of complex values.
Sign of real values or direction of complex values.
Syntax
sign(X)Real elements give -1, 0 or 1; NaN stays NaN. A nonzero complex value gives X/abs(X), and complex zero gives zero. Logical inputs convert to double.
Example
sign([-2 0 3 NaN]) % [-1 0 1 NaN]Differences from MATLAB: Only 2-D arrays are supported.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.