Fortune Telling Collection - Comprehensive fortune-telling - On the Logic Operation Command of matlab

On the Logic Operation Command of matlab

& and || are called &; And |,

A & ampB

(1) first judge the logical value of a, then judge the value of b, and then calculate the logical sum.

(2)A and B can be matrices (such as A=[ 1 0] and B=[0 0]).

A & amp& ampB

(1) First, judge the logical value of a. If the value of a is false, you can judge the value of the whole expression as false, so there is no need to judge the value of b..

(2)A and B cannot be matrices, but only scalars.

"|" is the same as "||", that is:

Associate member of the Institute of Bankers.

(1) first judge the logical value of a, then judge the value of b, and then calculate the logical OR.

(2)A and B can be matrices (such as A=[ 1 0] and B=[0 0]).

AIIB

(1) first judge the logical value of a. If the value of A is true, you can judge the value of the whole expression as true, and you don't need to judge the value of B. ..

(2)A and B cannot be matrices, but only scalars.

Example:

Extended description:

Except | and&; In addition to these two operators, there is a logical operator: non.

Not (or logical not) is a unary operator, that is ~A: when a is not zero, the result is "0"; When a is "0", the result is "1".