Chapter 4 : Programming with Matlab Flashcards
equal to
==
not equal to
~=
greater than or equal to
> =
less than or equal to
<=
less than
greater than
<
>
NOT
~
returns an array as the same dimension as A; the new array has 1s where A is 0 and 0s where A is nonzero
~A
AND
&
A & B
returns an array of the same dimension as A and B; then new array has 1s where both A and B have nonzero elements and 0s where either A or B is 0
short circuit AND
&&
operator for scalar logical expressions. returns true if both A and B evaluate true, and false if they do not
A && B
OR
|
A || B
operator for scalar logical expressions returns true if either A or B or both evaluate to true, and false if they do not
what is the order of precedence for operator types?
- parenthesis, starting with inner most pair
- arithmetic operators and logical NOT; evaluated left to right
- relational operators evaluated from left to right
- logical AND
- logical OR
what is the format for if then statements
if STATEMENTS EXPRESSION
STATEMENT GROUP 1
end