Command Reference : Function Reference : Function Reference: S
  
 
@sign
 
Sign of number.
Syntax: @sign(x)
x: number
Return: integer
Returns sign of x: -1, 0, 1 depending on the sign of x (“<0”, “=0”, “>0”).
Examples
= @sign(1.23)
returns 1.
matrix m1 = @round(@mnrnd(30, 2))
matrix m2 = @sign(m1)
produces a matrix of -1, 0, and 1 depending on the sign of the corresponding element of the randomly generated matrix M1.
vector v1 = @round(@mnrnd(30))
vector v2 = @sign(v1)
produces a -element sign vector corresponding to V1.
Cross-references
See also @egt, @eeq, and @elt.