DocumentationHelp Center
Unary minus
C = -A
C = uminus(A)
example
C = -A negates the elements of A and stores the result in C.
A
C
C = uminus(A) is an alternative way to execute -A, but is rarely used. It enables operator overloading for classes.
-A
collapse all
Create a 2-by-2 matrix, A.
A = [1 -3; -2 4]
A = 2×2 1 -3 -2 4
Negate the elements of A.
C = 2×2 -1 3 2 -4
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
single
double
int8
int16
int32
int64
uint8
uint16
uint32
uint64
logical
char
datetime
duration
calendarDuration
This function fully supports tall arrays. For more information, see Tall Arrays.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
minus | uplus
minus
uplus
A modified version of this example exists on your system. Do you want to open this version instead?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office