LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of hexadecimal strings to array of unsigned long integers

Hey,

 

I am pretty new to LabVIEW. In the attached VI, I would like to convert the output array (which has an indicator) to a 1D array of U32 type data. I cannot figure out a way to do it. Will it need a loop ? Any insight?

Thanks!

0 Kudos
Message 1 of 13
(2,589 Views)

Hello,

 

 

Not sure how to delete posts but my problem was solved. Please ignore.

0 Kudos
Message 2 of 13
(2,625 Views)

I tried looking at your block diagram...

 

...but I couldn't see anything wrong...

 

...but then I couldn't see anything right either...

 

...because I couldn't see anything at all.

 

Just fix your block diagram to make it right and everything will be fine.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 13
(2,616 Views)

Hi MBen,

 

use a FOR loop to iterate over the elements of your array. In the loop you convert the hex string (?) to a number, then format it using FormatIntoString with a format of "01%012b00000000" to get your desired output...

 

Btw you forgot to attach your VI!

 

Edit: Please don't delete full messages after posting. Especially after receiving answers! (You may notify the forum admins to delete your post in the message options...)

Best regards,
GerdW


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

How are the U32 encoded in the string? There is an infinite number of possibilities, of course.

Do you want little endian or big endian?

 

How about "unflatten from string" with a U32 array as type? But you need to expand to 4 bytes/elements first.

 

(Your controls are empty, so we cannot tell. Do you have a typical input string where you know the desired result?)

0 Kudos
Message 5 of 13
(2,569 Views)

Hi MBen,

 

first you post your question just to delete it several minutes later.

Now you post basically the same question, just without the needed information. (I merged both threads.)

 

Please provide all information needed to help you with your problems!

Best regards,
GerdW


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

Sorry about that!

 

A typical input would be 

"100

100

100"

 

and the desired result would be

 

50000

50000

50000

 

each as an individual element in the array just with data type U32.

 

Big Endian.

0 Kudos
Message 7 of 13
(2,515 Views)

Hi MBen,

 

based on the given information:

check.png

Best regards,
GerdW


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

Hey GerdW,

 

point taken I need to be more specific with my information. 

 

My attached VI already outputs 50000, 50000, 50000 (with the input of 100 100 100) as an array of strings. I want that as an array of U32 and can't find a way to convert it easily. 

0 Kudos
Message 9 of 13
(2,506 Views)

Hi MBen,

 

see my snippet in message #8: it converts a string into an array of U32 values.

When the string already contains the value 50000 then you don't need to multiply like I did…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 13
(2,499 Views)