You are on page 1of 8

Control Structures I

Control Structures I
• To understand how decisions are made in a computer.
• To understand the logical operators: and, or, and not.
• To understand how Matlab evaluates a logical expression.
• To write script using logical and comparative operators.
Relational Operations
Relational operators compare the elements in two
arrays and return logical true or false values to indicate
where the relation holds. 
Relational Operations
Logical Operations
The logical data type represents true or false states
using the numbers 1 and 0, respectively. Certain
MATLAB® functions and operators return logical values
to indicate fulfillment of a condition. You can use those
logical values to index into an array or execute
conditional code.
Logical Operations
Two – Way Selection
The basic decision statement in the computer is the
two-way selection. The decision is described to the
computer as a conditional statement that can be
answered either true or false. If the answer is true, one
or more action statements is executed. If the answer is
false, then a different action or set of actions is
executed.
Two – Way Selection

False True

Dec

False Action True Action

You might also like