Documentation

sign

Perform signum function on array

Syntax

c = sign(a)

Description

c = sign(a)returns an arraycthe same size asa, where each element ofcis

  • 1if the corresponding element ofais greater than zero

  • 0if the corresponding element ofais zero

  • -1if the corresponding element ofais less than zero

The elements ofcare of data typeint8.

signdoes not support complexfiinputs.

Extended Capabilities

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

Introduced before R2006a

Was this topic helpful?