Quantcast

Documentation Center

  • Trial Software
  • Product Updates

uminus, -

Syntax

Description

example

C = -A negates the elements of A and stores the result in C.

C = uminus(A) is an alternative way to execute -A, but is rarely used. It enables operator overloading for classes.

Examples

expand all

Negate Elements of Matrix

Create a 2-by-2 matrix, A.

A = [1 -3; -2 4]
A =

     1    -3
    -2     4

Negate the elements of A.

C = -A
C =

    -1     3
     2    -4

Input Arguments

expand all

A — Input arrayscalar | vector | matrix | multidimensional array

Input array, specified as a scalar, vector, matrix, or multidimensional array.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | char
Complex Number Support: Yes

See Also

|

Was this topic helpful?