DocumentationHelp CenterDocumentation
Unary minus
C = -
C = uminus(A)
example
C = -Anegates the elements ofAand stores the result inC.
C = -A
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×21 -3 -2 4
Negate the elements ofA.
C =2×2-1 3 2 -4
Input array, specified as a scalar, vector, matrix, or multidimensional array. IfAhas 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|calendarDurationComplex 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, seeTall Arrays.
backgroundPool
ThreadPool
This function fully supports thread-based environments. For more information, seeRun MATLAB Functions in Thread-Based Environment.
This function fully supports GPU arrays. For more information, seeRun MATLAB Functions on a GPU(Parallel Computing Toolbox).
This function fully supports distributed arrays. For more information, seeRun MATLAB Functions with Distributed Arrays(Parallel Computing Toolbox).
minus|uplus
minus
uplus
You have a modified version of this example. Do you want to open this example with your edits?
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