Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

gnegate

Generalized negation

Syntax

gnegate(x)

Description

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

Examples

Negate a Cell Array

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

Introduced in R2010b

Was this topic helpful?