Main Content

HowMATLABRepresents .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_Modulusandop_AdditionAssignment. For a complete list of operator symbols and the corresponding operator names, seehttps://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-1.1/2sk3x8a7(v=vs.71)?redirectedfrom=MSDNon theMicrosoft®Developer Networkwebsite.

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