11-15-2010 02:31 PM
You know,,,....a byte is a byte...why not just format the strings as byte binary in the Type Definition...and then fix them as strings only when they have to be converted for use...
???
Would that work? What kind of problems do you forsee with that?
Hummer1
11-15-2010 02:43 PM
The issue with strings is that they can be variable length in LabVIEW, so LabVIEW prepends a length byte when the data is flattened to a string. I didn't see arrays in your VI (maybe they were in the other VI), but arrays are also variable length and thus have length bytes added in.
You can treat the string as a series of U8 bytes, though it might be a pain to define them 63 U8's. You could define them as a bunch of U64, U32, U16, and U8 to have fewer data elements to define, then later to byte manipulation to convert them to an array of U8's and then to a string. Go ahead and experiment with that. I think you'll be able to get it to work.
11-15-2010 02:50 PM
Yes, the input data is an array of bytes (binary file)...as shown in the png image...It was way down in the bottom left hand corner...
I'll try the byte/number for string in the type def and let you know how it works out.
Thanks.
Hummer1
11-15-2010 03:08 PM
Okay, if what you have read in is an array of U8 bytes, then use Byte Array to String to convert it to a string. Then use the Unflatten from String like I showed earlier to turn it into a defined cluster.
11-15-2010 03:42 PM
Ahhh! That sounds right...let me give that a shot...thanks.
Hummer1
11-15-2010 04:17 PM
Nice try, but no joy. When you convert the cluster as you showed earlier, the boundaries are already identified for the lil-endian...etc. With the raw bin array, none of that format is known...
Guess I'll have to stick with the Russian approach ("Russian components, American components....all made in Taiwan... Armageddon the movie) and just keep hitting it with this big hammer in a sub VI...OH well...would have been nice to find a nice easy way.
Thanks.
Hummer1
11-15-2010 05:50 PM
Did you set the the constant going into the Unflatten from String to be Little Endian?
Post a copy of your binary file. Rename it to .txt if you need to in order to attach it. Attach a VI that contains the cluster you are trying to put it into (I'm not sure which of the original VI's you are working with. Is it Channel Header Info Parse.vi?) Also, any documentation that details how the file is laid out.