LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read two columns of data from a TDMS file.

Solved!
Go to solution

Hi all,

 

I'm trying to read two columns of data from the 2nd of a two sheet tdms file, as shown below.

 

TDMS file screenshot.jpg

 

The two columns of data then need to be split so they can be displayed in an xy graph and also to apply a linear fit VI. I have implemented the xy graph and linear fit using a txt file (see below), so all the outputs work, however implementing this with a tdms file is proving slightly more taxing. 

 

info2.txt screenshot.gif

txt file screenshot.gif

Tr plot 2.jpg

 

So essentially I dont know how to read the correct sheet and thus columns from the tdms file and subsequently how to produce the xy graph and linear fit from the data types produced. Here is my current attempt, which produces several terminal type errors, as well as not being able to select the correct data from the tdms.

 

Current TDMS prog screenshot.jpg

 

Any help/suggestions/example vi's on this asap would be greatly appreciated.

 

Thanks in advance,

 

Pete

0 Kudos
Message 1 of 14
(5,332 Views)

Pete,

 

The TDMI list contents that you have wired up will give you the names of the channels not the data within the channels.

 

It looks like you want indices 2,3 for columns 3,4

 

Then use the TDMI read VI for each of those channels to get the temperature array data.

0 Kudos
Message 2 of 14
(5,324 Views)

Hi,

 

Thanks for your post.

 

I've never used a TDMS file before and so the terminology of groups and channels and the read VI isnt 100% clear to me. I've had a play but still cant get it to work. Could you talk me through the use of read VI and how it relates to the sheets and columns of the file. Also if you do have time to amend my version then that would be amazing, I've attached my VI.

 

Thanks so much.

 

Pete

0 Kudos
Message 3 of 14
(5,315 Views)

Here's what I was thinking about.  

 

It's hard to know exactly how to parse the TDMS without knowing the structure. Channels in TDMS (if I recall correctly) are always 1D arrays.  And they can have attributes...so you can write properties back to the TDMS like, beginning and end Ts of linear portion of the curve as well as slope.

0 Kudos
Message 4 of 14
(5,310 Views)
Solution
Accepted by topic author Pete1

Also the TDMS file viewer. vi helps you to understand the data file structure easily.

 

 

Message 5 of 14
(5,308 Views)

Hi again,

 

Its producing a Error 2532 for both read VI's.

 

I've attached the tdms file and its index file for you to view and maybe diagnose the problem. I'm not sure as to the reason for the error.

 

Thanks,

 

Pete

0 Kudos
Message 6 of 14
(5,302 Views)

Sorry all working fine now! Was reading the wrong file! Thanks so much for all your help :).

 

Cheers,

 

Pete

0 Kudos
Message 7 of 14
(5,299 Views)

 

Pete, this works for me with your TDMS files...here is an image of the front panel.
Doesn't look the the bisquare is working as well here as in your other file.
You could just read group: data and channels: (1) Log10 time and (2) Temperature without listing contents.
FYI
Error 2532 occurred at an unidentified location
This error code is undefined. Undefined errors might occur for a number of reasons. For example, no one has provided a description for the code, or you might have wired a number that is not an error code to the error code input. 
Additionally, undefined error codes might occur because the error relates to a third-party object, such as the operating system or ActiveX. For these third-party errors, you might be able to obtain a description of the error by searching the Web for the error code (2532) or for its hexadecimal representation (0x000009E4).

Error 2532 occurred at an unidentified location
This error code is undefined. Undefined errors might occur for a number of reasons. For example, no one has provided a description for the code, or you might have wired a number that is not an error code to the error code input. 
Additionally, undefined error codes might occur because the error relates to a third-party object, such as the operating system or ActiveX. For these third-party errors, you might be able to obtain a description of the error by searching the Web for the error code (2532) or for its hexadecimal representation (0x000009E4).

 

0 Kudos
Message 8 of 14
(5,292 Views)

Thanks for the response again. The data file I've been using and sent to you I have just discovered hadnt been correctly formatted in the time column, i.e. the log10 calculation, so the time data is actually erroneous. But I've tried it with the proper data and it works fine!

 

Thanks again,

 

Pete

0 Kudos
Message 9 of 14
(5,284 Views)

Hi again,

 

The file I'm actually using produces 'not a value' in the first row of log10 time (see below), which the linear fit VI cant read properly, therefore doesnt function. Is there a way to start reading from the 2nd row of data?

 

Thanks,

 

Pete

0 Kudos
Message 10 of 14
(5,253 Views)