08-28-2008 02:35 AM - edited 08-28-2008 02:36 AM
08-28-2008 02:42 AM - edited 08-28-2008 02:43 AM
Can you suggest a better way?
08-28-2008 02:58 AM - edited 08-28-2008 02:59 AM
Start building an array using only the strings that aren't empty. Works fine for relatively small arrays.
08-28-2008 03:08 AM
08-28-2008 03:08 AM
Hi there
it's not clear what happens in the hidden cases. Please post complete shots or the vi itself.
08-28-2008 03:22 AM
If it's every 2nd element, you can use decimate array.
Also you could use the concat string funtion to create a single string. When your elements are all of the same width or empty, you can then slice the string into your string array.
Felix
08-28-2008 03:30 AM - edited 08-28-2008 03:30 AM
Instead of creating an array with every other element empty we can as well create the correct array directly.
See image.
Hope this helps,
Daniel
08-30-2008 02:35 AM
08-30-2008 03:17 AM - edited 08-30-2008 03:19 AM
You are doing this extremely complicated, inefficiently, and incorrectly. First you place your U8 data in a DBL array,
increasing the memory usage by a factor of 8. Then you duplicate the array, only to generate the need to zero the
duplicates in the output array and the remove them later. Doing a 8bit to 16bit conversion is basically an atomic
operation in LabVIEW. The most inefficient way would be to convert the parts to a binary formatted string, concatenate
the strings, and the scan them back to a number. If you want to do this, you need to use format %08x for the formatting,
else things break.
I have no idea why you are scanning the result back into a I32, since it is only a 16bit number. U16 would be correct.
It seems you need to seriously learn about data representations.
Anyway, all you need is a typecast to replace everything except the first while loop.
Seems you want little endian, so you also need to swap the bytes.
There are many ways to do this, a simple way is shown in the image. In the while loop, initialize the array as U8.
08-30-2008 03:47 AM - edited 08-30-2008 03:48 AM
It might be more efficient to convert the byte array to a string and then unflatten it as little endian U16 array.
Here's a quick rewrite of part of your code (remember, you need to built a U8 array from the visa data).