Jump to content

Functions Palette/Programming/Boolean: Difference between revisions

From LabVIEW Wiki
m Logmanoriginal moved page Boolean palette to Functions Palette/Programming/Boolean: Reflect palette hierarchy on the Wiki
m Add icons to sections
Line 3: Line 3:
The Boolean palette provides constants and functions that can be performed on [[Boolean]], [[Numeric]] and [[Fixed-point]] values.
The Boolean palette provides constants and functions that can be performed on [[Boolean]], [[Numeric]] and [[Fixed-point]] values.


== Logical And ==
== [[File:Andfunct.png|Logical And]] Logical And ==


Accepts two Boolean or [[Numeric|numeric]] inputs.
Accepts two Boolean or [[Numeric|numeric]] inputs.
Line 51: Line 51:
|}
|}


== Logical Or ==
== [[File:Orfunct.png|Logical Or]] Logical Or ==


Accepts two Boolean or [[Numeric|numeric]] inputs.
Accepts two Boolean or [[Numeric|numeric]] inputs.
Line 99: Line 99:
|}
|}


== Exclusive Or ==
== [[File:Xclusvor.png|Exclusive Or]] Exclusive Or ==


Accepts two Boolean or [[Numeric|numeric]] inputs.
Accepts two Boolean or [[Numeric|numeric]] inputs.
Line 147: Line 147:
|}
|}


== Not ==
== [[File:Notfunct.png|Not]] Not ==


Returns the inverted value of an Boolean or [[Numeric|numeric]] input.
Returns the inverted value of an Boolean or [[Numeric|numeric]] input.
Line 180: Line 180:
|}
|}


== Compound Arithmetic ==
== [[File:Comparit.png|Compound Arithmetic]] Compound Arithmetic ==


[[File:CompoundArithmeticChangeMode.png|thumb|Change mode on the Compound Arithmetic function]]
[[File:CompoundArithmeticChangeMode.png|thumb|Change mode on the Compound Arithmetic function]]
Line 203: Line 203:


<br clear="all">
<br clear="all">
== Not And ==
== [[File:Notandfn.png|Not And]] Not And ==


This is the same as [[#Logical_And|Logical And]] but the output is inverted.
This is the same as [[#Logical_And|Logical And]] but the output is inverted.
Line 251: Line 251:
|}
|}


== Not Or ==
== [[File:Notorfun.png|Not Or]] Not Or ==


This is the same as [[#Logical_Or|Logical Or]] but the output is inverted.
This is the same as [[#Logical_Or|Logical Or]] but the output is inverted.
Line 299: Line 299:
|}
|}


== Not Exclusive Or ==
== [[File:Notxclor.png|Not Exclusive Or]] Not Exclusive Or ==


This is the same as [[#Exclusive_Or|Exclusive Or]] but with inverted output.
This is the same as [[#Exclusive_Or|Exclusive Or]] but with inverted output.
Line 347: Line 347:
|}
|}


== Implies ==
== [[File:Implies.png|Implies]] Implies ==


Accepts two Boolean or [[Numeric|numeric]] inputs.
Accepts two Boolean or [[Numeric|numeric]] inputs.
Line 395: Line 395:
|}
|}


== And Array Elements ==
== [[File:Andarray.png|And Array Elements]] And Array Elements ==


Performs the [[#Logical_And|Logical And]] on an n-dimensional [[Array|array]] of Boolean values. This means, the output is [[File:BooleanTrue2010.png|border|True]] if '''all''' elements of the array are [[File:BooleanTrue2010.png|border|True]]. Note that this function works an multi-dimensional arrays, not just one-dimensional.
Performs the [[#Logical_And|Logical And]] on an n-dimensional [[Array|array]] of Boolean values. This means, the output is [[File:BooleanTrue2010.png|border|True]] if '''all''' elements of the array are [[File:BooleanTrue2010.png|border|True]]. Note that this function works an multi-dimensional arrays, not just one-dimensional.


== Or Array Elements ==
== [[File:Orarray.png|Or Array Elements]] Or Array Elements ==


Performs the [[#Logical_Or|Logical Or]] on an n-dimensional [[Array|array]] of Boolean values. This means, the output is [[File:BooleanTrue2010.png|border|True]] if '''any''' element of the array is [[File:BooleanTrue2010.png|border|True]]. Note that this function works an multi-dimensional arrays, not just one-dimensional.
Performs the [[#Logical_Or|Logical Or]] on an n-dimensional [[Array|array]] of Boolean values. This means, the output is [[File:BooleanTrue2010.png|border|True]] if '''any''' element of the array is [[File:BooleanTrue2010.png|border|True]]. Note that this function works an multi-dimensional arrays, not just one-dimensional.


== Num to Array ==
== [[File:Numtoboo.png|Num to Array]] Num to Array ==


Converts an [[Integer|integer]] or [[Fixed-point|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.
Converts an [[Integer|integer]] or [[Fixed-point|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 ==
== [[File:Bootonum.png|Array to Num]] Array to Num ==


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


== Bool to (0,1) ==
== [[File:Bootoone.png|Bool to (0,1)]] Bool to (0,1) ==


Returns a Boolean into a 16-bit [[Integer|integer]].
Returns a Boolean into a 16-bit [[Integer|integer]].
Line 426: Line 426:
|}
|}


== True Constant ==
== [[File:BooleanTrue2010.png|True Constant]] True Constant ==


This is the Boolean True constant [[File:BooleanTrue2010.png|border|True]]
This is the Boolean True constant [[File:BooleanTrue2010.png|border|True]]


== False Constant ==
== [[File:BooleanFalse2010.png|False Constant]] False Constant ==


This is the Boolean False constant [[File:BooleanFalse2010.png|border|False]]
This is the Boolean False constant [[File:BooleanFalse2010.png|border|False]]

Revision as of 17:01, 24 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 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 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 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 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 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 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 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 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 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 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 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 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 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) Bool to (0,1)

Returns a Boolean into a 16-bit integer.

x output
False 0
True 1

True Constant True Constant

This is the Boolean True constant True

False Constant False Constant

This is the Boolean False constant False

See also