LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading TDMS files in Matlab

I am trying to read TDMS files directly into Matlab using the NI  nilibddc.dll. I have read most of the posts on here but still have a problem...

Within Matlab I can open and read a file and get the data but I cant find anything that tells me what the sample interval (between samples) is for a particular file. I guess its in the header somewhere but how do I access it?

I cant find anything that tells what function to use to get it from the header.

In fact i cant find anyhting that tells me what the functions are in the DLL.

I tried opening the CHM help file, this has a list of all the functions but when you click on one in the contents it reports 'the address is not valid'. It seems the link is borken somehow in the help file (this is on XP)!

 

any help gratefully receieved!

 

mike

 

 

 

0 Kudos
Message 1 of 3
(3,118 Views)

I'm not sure what happened to the documentation, but if you're a bit programming-savvy, you could look at the header file that comes with the MatLab integration (.\MATLAB TDM Example\dev\include\nilibddc_m.h). It has all functions listed with their parameters.

 

Sample rates, acquisition start times etc. are usually channel properties that you can access with DDC_GetChannelProperty and some related helper functions. This however depends on what software you have written the file with. If you write waveforms in LabVIEW to TDMS, they will have a set of properties that contains this information. If you write numeric arrays in LabVIEW, your LabVIEW application would have to take care of setting these properties. Similarly, writing TDMS files in LabWindows/CVI, Measurement Studion or DIAdem will not necessarily create these properties for you automatically.

 

Herbert

0 Kudos
Message 2 of 3
(3,114 Views)

hi mike,

 

if your data is stored in form of waveforms, this information can be retrieved from the channel:

 

Entity

Property

Data type

Description

tdm_channel

wf_xname

string

Name of the x-channel of the waveform

tdm_channel

wf_xunit_string

string

Unit text of the x-channel

tdm_channel

wf_start_time

time

Time stamp for the waveform

tdm_channel

wf_start_offset

double

Starting offset (to be added to the time stamp)

tdm_channel

wf_increment

double

Increment

tdm_channel

wf_samples

long

Number of samples in one shot (needed by LabVIEW when concatenating more consecutive shots). This property is used by DIAdem and DataFinder to decide whether the tdm_channel is a waveform (wf_samples > 0) or not (wf_samples = 0, or not existing).

tdm_channel

wf_time_pref

string

(enum: "absolute" or "relative") Additional information for LabVIEW to determine if the x-channel is treated as time (absolute) or as index (relative). (not available in LVM)

 

0 Kudos
Message 3 of 3
(3,106 Views)