Documentation

gnegate

Generalized negation

Syntax

gnegate(x)

Description

gnegate(x) takes a matrix or cell array of matrices, and negates their element values.

Examples

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 =

    -1    -2
    -3    -4


ans =

    -1     3
     5    -2

Was this topic helpful?