From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS File Viewer and TDMS List Contents Don't Give the Same Answers.

Solved!
Go to solution

I'm hoping there is a simple explanation to this problem.  If I use the TDMS File Viewer, it can successfully open my large data experiment files.  The contents are listed without any problem.  Now, if I use the TDMS List Contents VI, I expect to see the groups and channels names sans data in an indicator.  Instead, I only get 1 group and its associated channel(s).  Why the discrepancy? Thanks.

 

TDMS_check.png 

0 Kudos
Message 1 of 7
(3,171 Views)

If you wire a group name to "TDMS List Contents", it will give you a 1D array of strings with the channel names for the channels in that group. If you don't wire a group name, it'll give a a 1D array of strings with all group names in your file, plus a 2D array of strings with all objects in your file, where each object is described by it's group and channel names.

 

This is so two ways of processing your file can be implemented in an efficient manner: In order to process everything in the file within a single loop, you can iterate the 2D array. In order to process data based on which group it is in, you can iterate the array of group names in one loop and process the channels for each group in a second, nested loop. 

 

Hope that helps,

Herbert

 

0 Kudos
Message 2 of 7
(3,158 Views)

I agree that is how it should work, but I must be doing something wrong, because it isn't working that way.  I'll give you another example.

codeview.png 

With this code, I should get a listing of all the groups and channel objects (as I understand it).  This is what I get out of the TDMS viewer (correct) and this code snippet (List Contents incorrect):

TDMSViewer.png 

 

TDMSListContents.png 

 

So what am I doing wrong? 

0 Kudos
Message 3 of 7
(3,145 Views)

Not sure how this would happen. Could you attach an example TDMS file for us to look at?

 

Thanks,

Herbert

0 Kudos
Message 4 of 7
(3,137 Views)

Herbert Engels wrote:

Not sure how this would happen. Could you attach an example TDMS file for us to look at?

 

Thanks,

Herbert


I'm afraid that's not easily done.  The data sets are too large to send.   I can tell you this though, other TDMS data files don't seem to suffer from the same problem using this code.
I just tried something on a whim.  I do get the correct values if I tell the TDMS Open VI to open it as a read-only file.  If I put it back to "Open", it fails.  Why would that be? I should note that these files were write-protected at one time, and then had that attribute removed.  So, even without write-protection on (now), the files won't open properly unless "Open (read-only)" is selected.
 
correct_readOnly.png
testWorked.png 

 

0 Kudos
Message 5 of 7
(3,122 Views)
Solution
Accepted by topic author manjagu

Are the *.tdms_index files still write-protected? Could you try to delete the index files and open the tdms files without them (LabVIEW will generate new index files if you do that)?

 

Herbert

Message 6 of 7
(3,117 Views)

Herbert Engels wrote:

Are the *.tdms_index files still write-protected? Could you try to delete the index files and open the tdms files without them (LabVIEW will generate new index files if you do that)?

 

Herbert


I went ahead and deleted the index files and re-opened the tdms files as you suggested. LV re-created the index files and was able to read the data.  So things are back to normal.  That seems like an odd bug that ought to be addressed.  Some sort of flag or equivalent is causing the index files to be left in an odd state.  I wouldn't have thought changing a read-only status would have caused such a problem.  Thanks! 

 

0 Kudos
Message 7 of 7
(3,095 Views)