Generalized negation
gnegate(x)
gnegate(x)
takes a matrix or cell array of matrices, and negates their
element values.
This example shows how to negate a cell array:
x = {[1 2; 3 4],[1 -3; -5 2]}; y = gnegate(x); y{1}, y{2}
ans = 2×2
-1 -2
-3 -4
ans = 2×2
-1 3
5 -2