MATLAB® supports overloaded operators, such as the C# operator symbols
+
and *
, as shown in the following table.
MATLAB implements all other overloaded operators, such as %
and +=
, by their static method names, op_Modulus
and op_AdditionAssignment
. For a complete list of operator symbols
and the corresponding operator names, see https://msdn.microsoft.com/en-us/library/2sk3x8a7(VS.71).aspx on the
Microsoft® Developer Network website.
C++ Operator Symbol | .NET Operator | MATLAB Method |
---|---|---|
+ (binary) | op_Addition | plus , + |
- (binary) | op_Subtraction | minus , - |
* (binary) | op_Multiply | mtimes , * |
/ | op_Division | mrdivide , / |
&& | op_LogicalAnd | and , & |
|| | op_LogicalOr | or , | |
== | op_Equality | eq , == |
> | op_GreaterThan | gt , > |
< | op_LessThan | lt , < |
!= | op_Inequality | ne , ~= |
>= | op_GreaterThanOrEqual | ge , >= |
<= | op_LessThanOrEqual | le , <= |
- (unary) | op_UnaryNegation | uminus , -a |
+ (unary) | op_UnaryPlus | uplus , +a |