MATLAB Programming/Operators

From Wikibooks, open books for an open world
< MATLAB Programming
Jump to navigation Jump to search

MATLAB Operators[edit]

Operators[edit]

Operator Function
Unary Operators
+ positive number
- negate
% comment
' transpose
@ function handle
Binary Operators
+ addition
- subtraction
* inner product (multiplication)
/ division (matrix right)
\ left division
^ power
: (colon) generates a sequence
Element-wise Operators
.* element-wise inner product (multiplication)
./ element-wise division (matrix right)
.\ element-wise left division
.^ element-wise power
.' element-wise transpose
Relational Operators
< less than
<= less than or equal to
> greater than
>= greater than or equal to
== equal to
~= not equal to
Logical Operators
&& logical AND
| | logical OR
~ logical NOT
Other Operators
, Array row separator
; Array column separator