How Do I Convert a Boolean Array To Fixed Point Number?

Updated Oct 20, 2023

Reported In

Software

  • LabVIEW

Issue Details

I have a boolean array that I would like to convert into a fixed point number. I have tried using the basic typecast function, but this does not produce the wanted result. How do I make this conversion?

Solution

In order to convert a boolean array into a fixed point number, you can convert the boolean array into an integer using the To Word Integer Function, then convert that into a fixed point number by using the Integer to Fixed-Point Cast Function. This function uses an arithmetic shift of the input to ensure that the least significant bit of the input becomes the least significant bit of the output.