06-14-2010 02:32 PM
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?
Solved! Go to Solution.
06-14-2010 02:34 PM - edited 06-14-2010 02:34 PM
06-14-2010 02:41 PM - edited 06-14-2010 02:44 PM
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.
06-14-2010 02:44 PM
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.
06-14-2010 02:57 PM
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.
06-14-2010 03:01 PM
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.
06-15-2010 09:05 AM
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?
06-15-2010 09:18 AM - edited 06-15-2010 09:19 AM
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:
06-15-2010 10:04 AM
Got it!
Thank you.