LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Hexadecimal String to Byte Array

Solved!
Go to solution
Solution
Accepted by topic author Nelval

Hi Neival,

 

something like this may work for you:

check.png

(String in normal display mode…)

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 11 of 29
(2,916 Views)

I already came up with a solution pretty similar, I was expecting something a bit more builtin from LabVIEW, anyway, thanks.

 

 

Message 12 of 29
(2,904 Views)
Sorry for the misunderstanding... another way of doing the conversion
0 Kudos
Message 13 of 29
(2,897 Views)

And where do these "solutions" do a left padding of the last "4" in the original example string?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 14 of 29
(2,894 Views)

Hi Christian,

 

why insist on left padding? Conversion of trailing "4" will give the expected result 4…

 

The question should rather be: Why does the data source omit the zero padding leaving us with an odd number of chars?

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 15 of 29
(2,891 Views)

@GerdW wrote:

why insist on left padding? Conversion of trailing "4" will give the expected result 4…


Yes, yours does, but the other two don't.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 16 of 29
(2,886 Views)
Solution
Accepted by topic author Nelval

Here's what should cover all scenarios (odd or even lenght)

 

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 17 of 29
(2,880 Views)

@altenbach wrote:

Here's what should cover all scenarios (odd or even lenght)

 

 


 

 

Thanks for completing that part of the solution.

0 Kudos
Message 18 of 29
(2,867 Views)

I know this post has been marked answered, but I just can't help myself.  And I do have the greatest respect for Chris' experience.

 

Mostly in answer to Vijay's several attempts (some flat-out wrong, and the final one close but improvable), I'll attach the following two images (note, only one is a snippet):

 

Efficient conversion of string of char pairs to U8 array.pngtire_swing.jpg

 

 

 

 

 

 

Apologies to all and best regards,

Dave

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
0 Kudos
Message 19 of 29
(2,826 Views)

for the fun of it:

 

HexStringToBytes.png

0 Kudos
Message 20 of 29
(2,810 Views)