Main Content

gnegate

(To be removed) Generalized negation

gnegate will be removed in a future release. For more information, see Transition Legacy Neural Network Code to dlnetwork Workflows.

For advice on updating your code, see Version History.

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 = 2×2

    -1    -2
    -3    -4

ans = 2×2

    -1     3
     5    -2

Version History

Introduced in R2010b

collapse all