LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert and Display 1D array of Bits to a hex string

Solved!
Go to solution

Hello,

 

I'm a beginner to Labview. My VI has used the "Build Array" function to index specific array elements of a larger 2D array and put them into a 1D array. The array, for example, contains "0 0 1 0 0 0 1 1". I want to display this as a hexadecimal string on the front panel as an output. 

 

I could not figure out a suitable function to do this. My last attempt is shown below in which I use the "Array to Spreadsheet String" function, but my front panel still displays the bits.

image.png

 

0 Kudos
Message 1 of 5
(3,152 Views)
Solution
Accepted by topic author MBen11

Hi MBen,

 

compare the 1D array with "unequal to zero" to get a boolean array. Then use BooleanArrayToNumber to convert to an integer number. Now use FormatIntoString with any format code you like...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,130 Views)

1) Check the endian order and reverse array if needed

2) convert to boolean array with "Not Equal To 0?"

3) "Format Into String" to display the way you need.

Message 3 of 5
(3,127 Views)

Edit: Got it - Thanks for the help! 

0 Kudos
Message 4 of 5
(3,089 Views)
Solution
Accepted by topic author MBen11

Sorry about that.  Here is the image.bit array to hex string.png

As you can see the Not Equal to 0? does not need to be in a loop.

Message 5 of 5
(3,085 Views)