Jump to content

Flatten to string in Labview; unflatten in LabWindows


torekp

Recommended Posts

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.

Link to comment

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.

Link to comment
  • 2 weeks later...

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.

Link to comment

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).

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.