sign

Perform signum function on array

Syntax

c = sign(a)

Description

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