uminus - Unary minus - MATLAB (original) (raw)
Main Content
Syntax
Description
C = -[A](#btykb4h-A)
negates the elements ofA
and stores the result in C
.
C = uminus([A](#btykb4h-A))
is an alternative way to execute -A
, but is rarely used. It enables operator overloading for classes.
Examples
Create a 2-by-2 matrix, A
.
Negate the elements of A
.
Input Arguments
Input array, specified as a scalar, vector, matrix, or multidimensional array. If A
has an integer data type, then it cannot be complex.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
| char
| datetime
| duration
| calendarDuration
Complex Number Support: Yes
Extended Capabilities
Theuminus
function fully supports tall arrays. For more information, see Tall Arrays.
The uminus
function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced before R2006a