06-19-2019 08:25 AM - edited 06-19-2019 08:30 AM
Hello all.
I'm trying since a few days to make an VI which sort my elements in 3 byte arrays.
I receive by serial a string of characters and and my purpose is to obtain 3 byte arrays from the elements received.
The string that i received, converted in hex bytes is of this shape: FF byte1 byte2 byte3 FF byte1 byte2 byte3 FF ....
I need to obtain three array with the elements of byte1 / byte2 / byte3. I use FF as a delimiter between a series of 3 bytes. I tried using an match pattern on the string by the FF corresponding character, but in the end the data are mixed in the arrays.(i don't know why)
Can anyone have a solution for this? Is there a possibility for sorting the array of bytes, not on the string?
Thanks.
Solved! Go to Solution.
06-19-2019 08:41 AM
06-19-2019 08:43 AM
Use reshape array to give you a 4 column X row array. Then just do an array subset for the 2nd, 3rd, and 4th columns, since the FF's fill be filling the first column.
06-19-2019 11:55 AM
I don't know if this fits the OP's requirement. This will output the data array for any number of bytes between the FF delimiters.
06-19-2019 12:00 PM
Was thinking that if you need exactly 3 bytes, you could change it to a conditional tunnel
06-19-2019 12:08 PM
The flaw is that all rows will be padded to the longest row.
06-19-2019 12:30 PM
@altenbach wrote:
The flaw is that all rows will be padded to the longest row.
I beleive my second post fixes the flaw of zero padding the array to the longest row.
My way may not be the best way, But to me it just seems GerdW's code is a little convoluted using a case structure, build array, and shift registers when a conditional tunnel is all that is needed.
06-19-2019 01:15 PM
Hi Jamiva,
But to me it just seems GerdW's code is a little convoluted using a case structure, build array, and shift registers when a conditional tunnel is all that is needed.
I made that example using LV2011: no conditional tunnels…