torekp Posted December 1, 2010 Report Share Posted December 1, 2010 My title pretty much sums it up. I need to flatten my data to a byte array to pass it to another computer. (Via reflective memory cards, if that matters, which it really doesn't.) The other computer has CVI LabWindows. Unfortunately there is no equivalent function, so far as I know, in LabWindows, exactly like Unflatten From String in Labview. If I'm wrong about that, I'd be glad to hear it. So the next best thing is to find a pair of ways to flatten and unflatten that are both reasonably fast. If anyone knows the secret formula for Labview's flattened data (for data types string, 1D array of i32s, and 2D array of SGL) that would help a lot. Including big-endian or little-endian conversion of i32s, and where the mantissa from SGL winds up. Quote Link to comment
Yair Posted December 1, 2010 Report Share Posted December 1, 2010 The way LV stores flattened data is explained in the LabVIEW help (presumably the flatten primitive has a link to the relevant section). Another option would be to convert the data to your own format which both programs can read (e.g. plain ASCII). This should probably be easier, and I'm not sure you'd be hurt in performance. Quote Link to comment
torekp Posted December 14, 2010 Author Report Share Posted December 14, 2010 The way LV stores flattened data is explained in the LabVIEW help (presumably the flatten primitive has a link to the relevant section). It doesn't have that link, and what I found on my own wasn't helpful, but a little experimenting showed what's going on. For arrays, you get 4 bytes containing the (big-endian) length of the array, followed by the elements (e.g., 4 bytes per SGL) in standard format (IEEE blah blah). So I wound up just programming the LabWindows computer to parse the flattened data in the corresponding way. Unfortunately, the communication device (a reflective memory card) giving the Labview data to the other computer transformed the data to little-endian. So some pointer magic was required on the receiving end to reorder the bytes. Quote Link to comment
Yair Posted December 14, 2010 Report Share Posted December 14, 2010 It doesn't have that link... It does from where I'm looking at it. This is the relevant section - http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/flattened_data/ Also, the Flatten primitive has a byte order input which could have also taken care of the other issue you had. I believe it gained it in 8.0, so if you're using an older version that might also explain why you haven't seen the link (although I would have expected it there in older versions as well, since it's "obvious" that it should be there). Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.