LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading built-in properies from TDMS files

Solved!
Go to solution

I found a problem with CVI 2010 SP1 reading built-in properties from a TDMS file.

The functions:

  • TDMS_GetFileStringPropertyLength with property TDMS_FILE_NAME
  • TDMS_GetFileProperty with property TDMS_FILE_NAME
  • TDMS_GetChannelGroupStringPropertyLength with property TDMS_CHANNELGROUP_DESCRIPTION

return error -6629 TDMS_PropertyDoesNotExist if these properites exist but are an empty string!

I think that this error should be returned only if the property really doesn't exist, not if it is an empty string.

 

I saw this using TdmsReader supplied example with one of my TDMS files.

 

   
Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 6
(3,850 Views)

Are you certain the property exists in the file? I can't reproduce the problem you described with the example code I've included below.

 

unsigned int len;
TDMSFileHandle file;

TDMS_CreateFileEx ("c:\\myfile.tdms", TDMS_Streaming2_0, TDMS_ByteOrderNative, 0, "myfile", "", "", "", &file);
TDMS_GetFileStringPropertyLength (file, TDMS_FILE_DESCRIPTION, &len); // No error is returned here and the output value of len=0, just as I would expect.
TDMS_SaveFile (file);
TDMS_CloseFile (file);

Jeff

NI

 

0 Kudos
Message 2 of 6
(3,834 Views)

I saw the properties when I open the TDMS with the Excel viewer plugin

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 6
(3,832 Views)

My files are quite old (TDMS 1.0 format), that I converted to 2.0 with this vi.

Could this be the reason?

Could someone confirm this behavior with TDMS 1.0 files?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 4 of 6
(3,811 Views)
Solution
Accepted by topic author vix

Hi Vix,

 

Was the file created in CVI or LabVIEW? When creating the TDMS file in CVI, the name property is required or the TDMS_CreateFileEx will return an error. However, the TDMS Open vi (with the create option) does not require the name property to be set. So if the file was created in LV, then unless the name property was specifically created, then it does not exist. In the Excel plugin, if the name property does not exist, it will default to the actual file name (the name property does not necessarily have to match the file name).

 

Since you have access to LV, you can simply add this property yourself with the TDMS Set Property vi. It may also be good habit to always set the 4 standard properties when creating TDMS files in LV.

National Instruments
Message 5 of 6
(3,799 Views)

Hi D

I'm not sure because one of our customers sent me these files, but I think that they were created with LabVIEW.

Your explanation is very good: in the Excel sheet I saw the property names with empty values, but probably it's the behavior of the plugin

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 6 of 6
(3,784 Views)