Graphics Programs Reference
In-Depth Information
Comparison Operators
The comparison (relational) operators return1 for true and 0for false. These operators
are
<
Less than
>
Greater than
<
= Less than or equalto
>
= Greater than or equalto
== Equalto
˜= Not equalto
The comparison operators always act element-wise onmatrices; hence theyresult in
amatrix of logical type.For example,
>>A=[123;456];B=[789;012];
>>A>B
ans =
0
0
0
1
1
1
Logical Operators
The logicaloperators in MATLAB are
& AND
|
OR
˜ NOT
Theyare used to build compound relationalexpressions, an example of which is
shown below.
>>A=[123;456];B=[789;012];
>>(A>B)
|
(B>5)
ans =
1
1
1
1
1
1
Search WWH ::




Custom Search