Jump to content

TDMS + ListBox Problem


Recommended Posts

I made my first attempt at using TDMS files yesterday and I had some unexpected results. I was using TDMS files to store data from a multicolumn list box control. When I wired the ItemNames property to the data input of TDMS write, the resulting data file did not match the data coming out of the property. Only after running the data through two for loops did the data save correctly. The following images and VI illustrate the problem.

The Data:

post-151-1169298426.jpg?width=400

Method 1: Single write

post-151-1169298665.jpg?width=400

Results:

post-151-1169298706.jpg?width=400

Method 2: Wrap the write in For loop and write one column at a time.

post-151-1169298681.jpg?width=400

Results: The same.

post-151-1169298716.jpg?width=400

Method 3: Add For loop in the For loop that does nothing.

post-151-1169298693.jpg?width=400

Results: Expected data.

post-151-1169298728.jpg?width=400

Download File:post-151-1169298761.vi

Is this my bad, a bug with ListBox data, or a bug with TDMS?

Link to comment

That's a bug with TDMS. TDMS Write will handle subarrays either correctly or incorrectly, depending on what array dimension the "sub" applies to. Apparently, the "transpose array" you are using on the output of the "item names" property puts out the kind of subarray TDMS Write struggles with.

There are 2 related issues you might need to be aware of:

- Several TDMS functions have problems working with subarrays wired to "channel names".

- TDMS Set Properties doesn't appreciate subarrays for either "property names" or "property values".

All of these issues are fixed by now. I ran your VI with a current LabVIEW dev build, and all three cases work just fine.

For now, the workaround for all of that is to turn the subarrays back into regular arrays, which is what the additional for loop is doing in the third case. If you place that for loop right behind "transpose array", the whole VI is going to work. :throwpc:

Sorry for the inconvenience.

Herbert

Link to comment

Thank you for the detailed response. After reading your post, I made another version of my test VI "Method 2" that did not transpose the array, but instead indexed the column inside the For loop. This new VI gave the same bad results as before, so it does not appear to be the fault of the transpose array.

Download File:post-151-1169307909.vi

It's good to know that this will be fixed in the next release and for now I have a work around.

That's a bug with TDMS. TDMS Write will handle subarrays either correctly or incorrectly, depending on what array dimension the "sub" applies to. Apparently, the "transpose array" you are using on the output of the "item names" property puts out the kind of subarray TDMS Write struggles with.

There are 2 related issues you might need to be aware of:

- Several TDMS functions have problems working with subarrays wired to "channel names".

- TDMS Set Properties doesn't appreciate subarrays for either "property names" or "property values".

All of these issues are fixed by now. I ran your VI with a current LabVIEW dev build, and all three cases work just fine.

For now, the workaround for all of that is to turn the subarrays back into regular arrays, which is what the additional for loop is doing in the third case. If you place that for loop right behind "transpose array", the whole VI is going to work. :throwpc:

Sorry for the inconvenience.

Herbert

Link to comment

The problem is not with a particular function, but with all functions that create subarrays, e.g. transpose, index, or subset. Subarrays are used in LabVIEW to save memory by not making unnecessary copies of an array. Transpose will not actually transpose the array, but it will attach a piece of information that flags this array as transposed. Index and subset will not create new arrays (or values) that they copy data into, they will just add a piece of information to the array that describes which part of the array is to be used by subsequent functions. Indexing tunnels will do the same thing. That way, it's up to the functions down the wire to decide whether or not to make a data copy. Arrays that carry this kind of additional information are referred to as "subarrays".

The online help will show whether you have an array or a subarray when you hover over an array wire.

Hope that helps,

Herbert

Link to comment
That's a cool feature that I didn't know! This would make a good nugget for Darren.

It's like that for (almost) any data type these days - especially useful for complex data types like clusters of clusters of clusters of clusters of clusters of clusters of clusters of clusters of ...

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