!!!! BOOLEAN

BOOLEAN

|or ||exclusive or
&and ~not
=equal to ~=not equal to
>greater than <less than
>=greater than or equal to           <=less than or equal to

Boolean operators

The Boolean operators return a value of 0 when false and 1 when true.

The Boolean operators can operate on scalars, vectors, matrices, or tensors, but both operands must be the same size and shape. The result of the operation is a variable with this size and shape.

All of the Boolean operators are binary, except for the not operator, ~, which is unary.

Examples

Suppose you have two vectors: X = [1;2;3;4;5;6;7] and Y = [-2;-1;0;1;2;3;4]. Then,

 X|Y    = [1;1;1;1;1;1;1]

 X||Y   = [0;0;1;0;0;0;0]

 X&Y    = [1;1;0;1;1;1;1]

 X=Y    = [0;0;0;0;0;0;0]

 X~=Y   = [1;1;1;1;1;1;1]

 X>Y    = [1;1;1;1;1;1;1]

 X<Y    = [0;0;0;0;0;0;0]

 X>=Y   = [1;1;1;1;1;1;1]

 X<=Y   = [0;0;0;0;0;0;0]

 ~(X|Y) = [0;0;0;0;0;0;0]
 

  matrix transpose