Navigation: Language Reference > Functions > Arithmetic >
Y = sign(X);
Returns the sign of X or the elements of X.
X = < 0 : Y = -1
X = 0: Y = 0
X > 0: Y = 1
X
sign(X)
1
2.1
-2.6
-1
0
[1,2.1;-2.6,0]
[1,1;-1,0]
X and Y must have the same size.