LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW: TDMS file data could not be converted into the specified data type.

Solved!
Go to solution
Hi all,
I try to convert TDM and TDMS files to a text file.
 
With the TDM files there is no problem to read different data types (such as numerics, date/ time, and so on) as an array of strings, by using the "Get Properties" TDM Storage-VI: I've set the output data format to "Array of strings".
 
But I've problems to read channels from a TDMS file with different data types, because I always get an error
 
"Error -2525 occurred at TDMS Read in mainASCIIConverter.vi
Possible reason(s):
LabVIEW:  TDMS file data could not be converted into the specified data type."
 
, when I try to read a channel with data type "date/time" as a 1D- string array with the TDMS read VI (see attached picture)!
 
Can anyone help me to solve this problem?
 
Thanks
daHans
 
 
0 Kudos
Message 1 of 3
(5,284 Views)
The Storage VIs have a built-in mechanism for converting numeric data into strings, the upside being that it is convenient, the downside being that you have no influence on the formatting. The TDM Streaming API only converts data amongst different numeric types. If you need some code that converts all data coming from a TDMS file into strings, look at some of the code we use within the TDMS File Viewer in order to display all data in a table.

The VI you're looking for is .\vi.lib\Utility\tdmsutil.llb\loadAndFormatValues.vi. Th important part is in the upper part of the for loop, where we check for the data type, check for whether the channel length isn't zero, and then convert whatever data is in the channel into an array of strings. The output of the VI is a 2D array of strings just like the one you need for a spreadsheet file, so maybe you can reuse this VI with no changes.

Hope that helps,
Herbert
Message 2 of 3
(5,276 Views)
Solution
Accepted by topic author daHans

Hi Herbert,

thanks for your fast help.

I've only had to change some peanuts in the loadAndFormatValues.vi and now it works.

Thanks
daHans

0 Kudos
Message 3 of 3
(5,267 Views)