LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

bytes array to double words array

Solved!
Go to solution

I have an array of bytes. I need to take 4 bytes at a time to create a doubleword (32bits).

 

I am currently using Decimate Array and Join Numbers twice to do this.

 

Is there a more efficient way of doing this that I am overlooking?

0 Kudos
Message 1 of 9
(5,477 Views)
You can use get array subset VI get array subsets of 0-3, 4-7, etc etc and type cast. Don't know if this is more efficient, but is another way.
Message Edited by for(imstuck) on 06-14-2010 02:34 PM
0 Kudos
Message 2 of 9
(5,472 Views)

for(imstuck) wrote:
You can use get array subset VI get array subsets of 0-3, 4-7, etc etc and type cast. Don't know if this is more efficient, but is another way.

There is indeed. Just do it directly:

 

 

 

Note: This assumes no need to perform endianness manipulation. In that case you can use the Unflatten From String function, though that would require a detour to go to a string.

Message Edited by smercurio_fc on 06-14-2010 02:44 PM
0 Kudos
Message 3 of 9
(5,464 Views)

I would like to see the underlying code behind the Type Cast function.  It does so much.  Hmmm.... maybe I don't want to see it after all.  Smiley Surprised

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 9
(5,459 Views)

smercurio_fc wrote:
There is indeed. Just do it directly:

 

 

 

Note: This assumes no need to perform endianness manipulation. In that case you can use the Unflatten From String function, though that would require a detour to go to a string.


Doh, duh.

0 Kudos
Message 5 of 9
(5,445 Views)

for(imstuck) wrote:

smercurio_fc wrote:
There is indeed. Just do it directly:

 

 

 

Note: This assumes no need to perform endianness manipulation. In that case you can use the Unflatten From String function, though that would require a detour to go to a string.


Doh, duh.


 

Ditto.

 

 

 

Will give it a try tomorrow.

 

 

 

0 Kudos
Message 6 of 9
(5,441 Views)

smercurio_fc wrote:

for(imstuck) wrote:
You can use get array subset VI get array subsets of 0-3, 4-7, etc etc and type cast. Don't know if this is more efficient, but is another way.

There is indeed. Just do it directly:

 

 

 

Note: This assumes no need to perform endianness manipulation. In that case you can use the Unflatten From String function, though that would require a detour to go to a string.

Message Edited by smercurio_fc on 06-14-2010 02:44 PM

I do have to perform endian manipulation. The information is little endian. My original information is a string from a TCPIP read. My current attempt is to convert it to a bytes array.

 

Can you explain in more detail what I would do in this case?

 

 

0 Kudos
Message 7 of 9
(5,387 Views)
Solution
Accepted by topic author nyc_(is_out_of_here)

nyc wrote: I do have to perform endian manipulation. The information is little endian. My original information is a string from a TCPIP read. My current attempt is to convert it to a bytes array.

 

Can you explain in more detail what I would do in this case?


As I noted, you can use the Unflatten From String. Since the data is coming from a TCP Read you can wire that directly to it:

 

Message Edited by smercurio_fc on 06-15-2010 09:19 AM
0 Kudos
Message 8 of 9
(5,376 Views)

Got it!

Thank you.

 

 

0 Kudos
Message 9 of 9
(5,365 Views)