14-3 ��������������?

MATLAB ޿B⤸]Logical Operators^@TءG

޿B⤸
& AND
| OR
~ NOT

򥻤WAY@ܼƭȬ 0Ahuv]False^A_hYuuv]True^AҦpG

Example 1: 14-MATLABB⤸/logical01.ma = [1 2 0 3 4 2 0]; b = [0 2 3 5 4 0 0]; andResult = a & b % AND B orResult = a | b % OR B notResult = ~a % NOT B andResult = 0 1 0 1 1 0 0 orResult = 1 1 1 1 1 1 0 notResult = 0 0 1 0 0 0 1

O٦ all anyApUG

ҦpG

Example 2: 14-MATLABB⤸/logical02.ma = [0 1 2 3]; result1 = all(a) retult2 = any(a) result3 = any(a<0) result1 = 0 retult2 = 1 result3 = 0

all any O]iHx}JAɥL̷|C@ӦVqiBAҦpG

Example 3: 14-MATLABB⤸/logical03.ma = [1 2 3; 4 5 6]; output = all(a>2) output = 0 0 1


MATLAB{]pGJg