07-17-2014 11:28 AM
Hi all,
I am using the Flatten to String Function to convert a numerical array to a flattened data string in hexadecimal. When I do this, it adds 6 null characters (zeros) before every array element. How can I flatten my array without the addition of these null characters?
Thanks,
Jasmine
Solved! Go to Solution.
07-17-2014 11:31 AM
07-17-2014 11:44 AM
I think it is related, but I am a beginner with LabView and programming in general and do not understand the link between our issues and how to solve my problem. I have a link to the section of my vi in which I want the data string to be CA 00 01 F0 02 01 2C DF but is returning 0000 0008 0000 00CA 0000 0000 0000 0001 0000 00F0 0000 0002 0000 0001 0000 002C 0000 00DF instead.
07-17-2014 11:47 AM - edited 07-17-2014 11:49 AM
Change your datatype to U8 (bytes) and wire a false constant to prepend size.
WIth a byte array and no size prepended you could also Type Cast
07-17-2014 11:52 AM
By default, the Flatten To String adds a length to the beginning for the array/string size. So you are actually seeing an I32 (4 bytes) prepended to the actual data.
6 hex characters of 0? That is belivable. That would leave the other 2 nibbles for an appropriate length of your array (up to 255).
07-17-2014 12:01 PM - edited 07-17-2014 12:02 PM
Now that I'm looking at your code, that can be simplified A LOT.
07-17-2014 12:14 PM
That worked, thank you so much Darin.K
07-17-2014 12:15 PM
Thank you crossrulz!! Once I have the rest of my vi figured out I will consider this for simplifying it.