LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I get an actual hex number from an array. The array to hex converter produces two characters rather than a hex number.

Hey I got an exceptionally long boolean array - 544 elements, none of the techniques work as per the attachment to convert it to a HEX string.

 

What is the solution?

 

See attached VI...

 

common techniques to convert boolean array to hex string in LabVIEW

 

(these all produce wrong results)

0 Kudos
Message 11 of 15
(2,771 Views)

 If an indicator is showing a hex number like FF FF FF and you put the cursor in the indicator box, the cursor will move over each pair of FF's in one move because it is treated as a single number.

 

--- I don't know where this statement comes from, because it's just not the case.

 

"FF" is never considered to be "a single number" in hex, any more than "34" is a single number in decimal.

 

Hex notation is something that you impose on a number.  It doesn't change the number, it changes the process of turning a numeric quantity into characters on the screen.

 

If my value is 255, then it is 255 whether you show it as decimal 255, as hex 0xFF, or as binary 11111111.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 12 of 15
(2,767 Views)

Hi kate,

 

quite cool to refresh a thread older than 11 years...

 

This might be a solution for your question:

check.png

It displays your bits as binary number in a string 😄

 

To give a hint:

LabVIEW support floats up to EXT precision, holding 80 bits of mantissa. So you have to use some simple math to calc a EXT number from your bits by summing up some powers of 2...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 15
(2,764 Views)

@kate2012 wrote:

Hey I got an exceptionally long boolean array - 544 elements, none of the techniques work as per the attachment to convert it to a HEX string.


However, your attached example has only a boolean array with 8 elements. Can you make a more relasistic default value?


@kate2012 wrote:

(these all produce wrong results)


Then please tell us what the "right" result is. Since there is an infinite number of wrong results, but only one right result, we cannot conclude by elimination.


@kate2012 wrote:

... to convert it to a HEX string.


What is a HEX string? Do you want a binary string where each character corresponds to eight of the booleans or do you want a hex formatted string of that above result, exclusivley containing characters 0..F, or something else.

 

0 Kudos
Message 14 of 15
(2,752 Views)

OK, try something like this....  (LabVIEW 2012)

 

Even if it is not exactly what you want, it might give you some ideas. If one of the solutions is as desired, delete all the unecessary code. 🙂

 

 

Download All
0 Kudos
Message 15 of 15
(2,746 Views)