Main Content

How MATLAB Represents .NET Operators

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 on the Microsoft® Developer Network website.

C++ Operator Symbol.NET OperatorMATLAB Method
+ (binary) op_Addition plus, +
- (binary) op_Subtraction minus, -
* (binary) op_Multiplymtimes, *
/op_Divisionmrdivide, /
&&op_LogicalAndand, &
||op_LogicalOror, |
==op_Equalityeq, ==
>op_GreaterThangt, >
<op_LessThanlt, <
!=op_Inequalityne, ~=
>=op_GreaterThanOrEqualge, >=
<=op_LessThanOrEqualle, <=
- (unary)op_UnaryNegationuminus, -a
+ (unary)op_UnaryPlusuplus, +a