neg(-)
Syntax
-X
Arguments
X is a scalar/pair/vector/matrix.
Details
Return the negative of X.
Examples
x=1:2;
-x;
// output
-1 : -2
x=1 0 1;
-x;
// output
[-1,0,-1]
m=1 1 1 0 0 0 $ 2:3;
m;
#0 | #1 | #2 |
---|---|---|
1 | 1 | 0 |
1 | 0 | 0 |
-m;
#0 | #1 | #2 |
---|---|---|
-1 | -1 | 0 |
-1 | 0 | 0 |