gleichman Posted January 20, 2007 Report Share Posted January 20, 2007 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: Method 1: Single write Results: Method 2: Wrap the write in For loop and write one column at a time. Results: The same. Method 3: Add For loop in the For loop that does nothing. Results: Expected data. Download File:post-151-1169298761.vi Is this my bad, a bug with ListBox data, or a bug with TDMS? Quote Link to comment
Herbert Posted January 20, 2007 Report Share Posted January 20, 2007 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. Sorry for the inconvenience. Herbert Quote Link to comment
gleichman Posted January 20, 2007 Author Report Share Posted January 20, 2007 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. Sorry for the inconvenience. Herbert Quote Link to comment
Herbert Posted January 20, 2007 Report Share Posted January 20, 2007 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 Quote Link to comment
gleichman Posted January 20, 2007 Author Report Share Posted January 20, 2007 The online help will show whether you have an array or a subarray when you hover over an array wire. That's a cool feature that I didn't know! This would make a good nugget for Darren. Quote Link to comment
Herbert Posted January 20, 2007 Report Share Posted January 20, 2007 I was referring to the context help (CTRL-H) of course. I always get these confused. Herbert Quote Link to comment
crelf Posted January 20, 2007 Report Share Posted January 20, 2007 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 ... Quote Link to comment
Yair Posted January 20, 2007 Report Share Posted January 20, 2007 This would make a good nugget for Darren. Unfortuantely Darren decided to stop with the nuggets, but Ben suggested that the community tried to pick it up, so maybe some other contributor will use this. Quote Link to comment
crelf Posted January 20, 2007 Report Share Posted January 20, 2007 Unfortuantely Darren decided to stop with the nuggets, but Ben suggested that the community tried to pick it up, so maybe some other contributor will use this. That is a true shame - I always enjoyed Darren's nuggets. Since it's OT, I've started a new thread to see if we can collectively get the nuggets up and running again. 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.