Boolean Array To Number Function

Converts a Boolean array to an integer or a fixed-point number by interpreting the array as the binary representation of the number. The first element of the array corresponds to the least significant bit in the number.


icon

Inputs/Outputs

  • c1dbool.png Boolean array

    Boolean array is a one-dimensional array of Boolean values.

    This function truncates Boolean array if it is too long. If Boolean array is too short, this function pads Boolean array according to the Sign Extension Mode you can select by right-clicking the function.

    • Never —This function pads Boolean array with Boolean FALSE bits.
    • If Output Is Signed —(default) For an output with an unsigned representation, this function pads Boolean array with Boolean FALSE bits. For an output with a signed representation, this function pads Boolean array with the last element of the array.
    • Always —This function pads Boolean array with the last element of the array.
  • iu32.png number

    number is an integer or a fixed-point number.

    You can change the numeric representation of number on the Output Configuration page of the Properties dialog box. Right-click the function and select Properties to display the Properties dialog box.

  • The following table shows the relationship between Boolean array and number.

    Boolean array Output Representation Sign Extension Mode Binary Value number
    {FALSE, TRUE} I8 If Output Is Signed 11111110 -2
    {FALSE, TRUE} U8 If Output Is Signed 00000010 2
    {FALSE, TRUE, FALSE, TRUE} I8 Always 11111010 -6
    {FALSE, TRUE, FALSE, TRUE} I8 Never 00001010 10
    {FALSE, FALSE, TRUE, FALSE, TRUE} U8 If Output Is Signed 00010100 20
    {FALSE, FALSE, TRUE, FALSE, TRUE} U8 Always 11110100 244

    FPGA Module Details

    The following details apply when you use this object in an FPGA VI.

    Note The following details are subject to change with each version of the LabVIEW FPGA Module.
    Single-Cycle Timed Loop Supported.
    Usage The FPGA Module supports only one-dimensional arrays that resolve to a single size at compile time. The Boolean Array To Number function converts fixed-size arrays by default to use the smallest unsigned integer representation that will fit the array size.
    Timing This function requires no clock cycles to execute because it does not include internal registers.
    Properties Dialog Box The data type of number changes based on the size of the array when the Adapt to source checkbox in the Output Configuration page contains a checkmark. The following list describes the relationship between the array size and the data type of number:
    • If the array size is between 0 and 8, inclusive, number has a data type of U8.
    • If the array size is between 9 and 16, inclusive, number has data type of U16.
    • If the array is any other size, number has a data type of U32. For example, if Boolean array is a fixed-size array of size 9, number has a data type of U16.
    • If the number of elements in your array is between 33 and 64, inclusive, and you want all of them to be represented in the number, you must uncheck the Adapt to source checkbox. If the number of elements in your array exceeds 64, some of the elements from the array will not be represented in the number.
    Resources This function consumes no FPGA resources because it is purely a wiring operation.