&& || ! AND OR NOT XOR (Logical Operators)

Purpose:

Serves as logical operators.

Syntax:

val1 op val2

OPERATOR(val1, val2)

val1

-

A scalar, series, or table.

val2

-

A scalar, series, or table.

Returns:

A scalar, series, or table containing ones and zeros (True or False).

Example:

W1: {0, 4, 9, 1, 2, 5}

W2: {1, 4, 0, 9, 3, 6}

 

W1 && (W2 > 3)

 

returns the series {0, 1, 0, 1, 0, 1} containing ones wherever W1 and W2>3 are non-zero, and zeros elsewhere.

Example:

W1 || (W2 == 4)

 

returns a series {0, 1, 1, 1, 1, 1} containing ones wherever W1 is non-zero or wherever W2 equals 4, and zeros elsewhere.

Remarks:

The returned series of ones and zeros is called a "Binary Series" and is useful for identifying points that meet a given condition.

 

The following logical operators are supported:

 

 

Operator

Function

Description

&&

AND

logical and

||

OR

logical or

!

NOT

logical not

 

XOR

logical exclusive or

 

See Also:

< <= > >= == != (Conditional Operators)

>> << & ~ |+ |^ (Bit Operators)

AND

FLIPFLOP

NOT

NOTEQUAL

OR

XOR