02-07-2020 08:05 AM
Hello,
I would like to ask you for help with the splitting of an array. I need to obtain real values from the achieved values. That means 1st value + (2nd value * 256), after that 3rd value + (4th value * 256) and so on. These values I need to get into a new array. In attachment, you can find my tries for the solution.
Thank you,
Daniel
Solved! Go to Solution.
02-07-2020 08:11 AM - edited 02-07-2020 08:14 AM
Use Decimate Array to get two 1-D arrays of every other element.
Use Join Number to combine the two arrays into one array which will convert the U8's into U16's.

02-07-2020 09:31 AM - edited 02-07-2020 09:31 AM
Just to show some alternatives:
You could also use a Type Cast to cast the U8 array into a U16 array. But since you need Little Endian (Most Significant Byte is last), you need to use Swap Bytes afterwards.
Or you can use Byte Array To String and then Unflatten From String to convert into a U16 array. Make sure you tell it that the data is in Little Endian format and that the array length is not in the data.

02-07-2020 11:16 AM
Of course your entire original code is a bit weird. I don't have your BLE subVI, but isn't there a version that returns strings instead so you can use the little endian unflatten directly?
Also, can you explain the FOR loop? You are taking one entire second (due to the 100ms wait!) to add arrays of different length, only to ultimately retaining the result of the very last iteration, making the first 9 iterations obsolete. What was your thought process? Also the coercion dots tell us that your representations are probably not reasonable.