This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Perform signum function on array


c = sign(a)


c = sign(a) returns an array c the same size as a, where each element of c is

  • 1 if the corresponding element of a is greater than zero

  • 0 if the corresponding element of a is zero

  • -1 if the corresponding element of a is less than zero

The elements of c are of data type int8.

sign does not support complex fi inputs.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a

Was this topic helpful?