| Embedded MATLAB™ | ![]() |
| On this page… |
|---|
Embedded MATLAB functions support the following MATLAB program statements:
Statement | Description |
|---|---|
break statement | |
continue statement | |
for statement | |
if statement The conditions of an if statement cannot use & and | operators. In their place, use the && and || operators, respectively. To logically collapse vectors into scalars, use the function all. | |
return statement | |
switch statement The behavior matches the MATLAB switch statement, which executes only the first matching case. | |
while statement The conditions of while statements cannot use & and | operators. In their place, use the && and || operators, respectively. To logically collapse vectors into scalars, use the function all. |
Embedded MATLAB functions support the following MATLAB arithmetic operations:
Operator | Description |
|---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
.* | Array multiplication |
/ | Slash or matrix right division |
./ | Array right division |
\ | Backslash or matrix left division |
.\ | Array left division |
^ | Matrix power |
.^ | Array power |
[] | Concatenation of matrices |
' | Complex conjugate transpose |
.' | Transpose |
(r, c) | Matrix indexing, where r and c are vectors of row and column indices, respectively |
See Arithmetic Operators + - * / \ ^ ' in the MATLAB Function Reference documentation for detailed descriptions of each operator.
Embedded MATLAB functions support the following element-wise relational operators:
Operation | Description |
|---|---|
< | Less than |
<= | Less than or equal to |
>= | Greater than or equal to |
> | Greater than |
== | Equal |
~= | Not equal |
See Relational Operators < > <= >= == ~= in the MATLAB Function Reference documentation for detailed descriptions of each operator.
Embedded MATLAB functions support the following element-wise logical operators:
Operation | Description |
|---|---|
& | Logical AND This & operator is limited to use outside if and while statement conditions. In its place, use the && operator. To logically collapse vectors into scalars, use the function all. |
| | Logical OR This | operator is limited to use outside if and while statements. In its place, use the || operator. To logically collapse vectors into scalars, use the function all. |
- | Element complement |
xor | Logical exclusive-OR |
&& | Logical AND (short-circuiting) |
|| | Logical OR (short-circuiting) |
See Logical Operators: Element-wise & | ~ and Logical Operators: Short-circuit && || in the MATLAB Function Reference documentation for detailed descriptions of each operator.
![]() | Embedded MATLAB Coding Style | Embedded MATLAB Function Library Reference | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |