Jump to content

Functions Palette/Programming/Boolean: Difference between revisions

From LabVIEW Wiki
Add new page
 
m Rename category to "Functions Palette"
Line 438: Line 438:
* [[Boolean]]
* [[Boolean]]


[[Category:Palettes]]
[[Category:Functions Palette]]

Revision as of 17:39, 21 July 2019

Boolean palette (block diagram)

The Boolean palette provides constants and functions that can be performed on Boolean, Numeric and Fixed-point values.

Logical And

Accepts two Boolean or numeric inputs.

Boolean: If provided Boolean values, returns True if both inputs are True, otherwise returns False.

x y output
False False False
False True False
True False False
True True True

Numeric: If provided numeric values, performs a bit-wise AND operation.

Binary Decimal
x 10101010 170
y 11110000 240
output 10100000 160

Logical Or

Accepts two Boolean or numeric inputs.

Boolean: If provided Boolean values, returns True if any input is True, otherwise returns False.

x y output
False False False
False True True
True False True
True True True

Numeric: If provided numeric values, performs a bit-wise OR operation.

Binary Decimal
x 10101010 170
y 11110000 240
output 11111010 250

Exclusive Or

Accepts two Boolean or numeric inputs.

Boolean: If provided Boolean values, returns True if any input is True exclusively, otherwise returns False.

x y output
False False False
False True True
True False True
True True False

Numeric: If provided numeric values, performs a bit-wise XOR operation.

Binary Decimal
x 10101010 170
y 11110000 240
output 01011010 90

Not

Returns the inverted value of an Boolean or numeric input.

Boolean:

x output
False True
True False

Numeric:

Binary Decimal
x 10101010 170
output 01010101 -171

Compound Arithmetic

Change mode on the Compound Arithmetic function

Performs various logical and arithmetic operations on Boolean and numeric values for a dynamic amount of inputs.

Available operations:

This function is especially useful when doing logical and arithmetic operations on more than two input values.

Invert input and output:

The Compound Arithmetic function allows to invert any of the inputs as well as the output selectively.

Invert input on the Compound Arithmetic function


Not And

This is the same as Logical And but the output is inverted.

Boolean:

x y output
False False True
False True True
True False True
True True False

Numeric

Binary Decimal
x 10101010 170
y 11110000 240
output 01011111 95

Not Or

This is the same as Logical Or but the output is inverted.

Boolean:

x y output
False False True
False True False
True False False
True True False

Numeric:

Binary Decimal
x 10101010 170
y 11110000 240
output 00000101 5

Not Exclusive Or

This is the same as Exclusive Or but with inverted output.

Boolean:

x y output
False False True
False True False
True False False
True True True

Numeric:

Binary Decimal
x 10101010 170
y 11110000 240
output 10100101 165

Implies

Accepts two Boolean or numeric inputs.

Boolean: If provided Boolean values, returns False if the first input is True and the second input is False. Otherwise returns True.

x y output
False False True
False True True
True False False
True True True

Numeric: If provided numeric values performs a bit-wise implies operation.

Binary Decimal
x 10101010 170
y 11110000 240
output 11110101 -11

And Array Elements

Performs the Logical And on an n-dimensional array of Boolean values. This means, the output is True if all elements of the array are True. Note that this function works an multi-dimensional arrays, not just one-dimensional.

Or Array Elements

Performs the Logical Or on an n-dimensional array of Boolean values. This means, the output is True if any element of the array is True. Note that this function works an multi-dimensional arrays, not just one-dimensional.

Num to Array

Converts an integer or fixed-point number to a Boolean array. The size of the output array depends on the size of the provided number. Note that the least significant bit is at index zero.

Array to Num

Converts a Boolean array to an integer or fixed-point number with the least significant bit at index zero.

Bool to (0,1)

Returns a Boolean into a 16-bit integer.

x output
False 0
True 1

True Constant

This is the Boolean True constant True

False Constant

This is the Boolean False constant False

See also