06-10-2019 04:40 PM
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!
06-10-2019 02:58 PM - edited 06-10-2019 03:05 PM
Hello,
Not sure how to delete posts but my problem was solved. Please ignore.
06-10-2019 03:05 PM
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.
06-10-2019 03:07 PM - edited 06-10-2019 03:10 PM
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...)
06-10-2019 05:50 PM - edited 06-10-2019 05:53 PM
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?)
06-11-2019 03:42 AM - edited 06-11-2019 03:43 AM
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!
06-11-2019 08:53 AM
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.
06-11-2019 09:02 AM
06-11-2019 09:06 AM
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.
06-11-2019 09:22 AM - edited 06-11-2019 09:22 AM
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…