06-10-2010 03:58 AM
Hi,
I have to convert a monster array of doubles to an array of bytes.
So first I have to convert (type cast) all the DBLs to array of bytes of 8 elements. The result byte array has a size of 8 x size of Double array.
This takes sooooo long... Is there a fast way to do it?
Solved! Go to Solution.
06-10-2010 04:24 AM
06-10-2010 04:30 AM
06-10-2010 04:35 AM
Hi srikrishnaNF,
what are you doing there?
First you typecast to an array of U32 (I suppose), then split the U32 numbers in the loop to build a 4-element-U8-array, then autoindex those U8 arrays to form a bigger 2D array, then reshape that one to get the resulting 1D U8 array...
Why not directly typecast to U8 array?
I think I will post this thread to the RubeGoldberg-collection
06-10-2010 04:52 AM
Hi Gerd,
yes I have tried the pure X G function, but the speed is the same.
Typecasting a DBL array direct to a U8 array works fast!
MB
06-10-2010 05:19 AM
06-10-2010 03:20 PM
GerdW wrote:Hi MB,
direct typecasting works fast because LV doesn't need to shuffle any data from one place to the other...
That is not really true. Typecast in LabVIEW always converts data into big endian form. For doubles this means inverting the byte order of every double but this is indeed still lighting fast in comparison to taking apart an array and copying it back into another array.