LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

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

 

I am getting this error when I try to run a standard labview example. 

 

I am using Labview 2007, and I go to Example Finder. I open Read TDMS File.vi and click Run. Then I select my TDMS file. 

 

Even if I open a TDMS file that is small (70 MB) or large (700 MB) it always gives this error. 

 

Does anyone know why?

0 Kudos
Message 1 of 15
(2,107 Views)

Hello,

 

I am trying to create a labview VI or change my current VI so that it will generate a chart which shows my labview data.

 

Currently, I have a program reading values from a DAQ. It multiplies this value by 50 as the sensor I am using gives a voltage and you must multiply by 50 to get it into the sensor value. 

 

The VI works great and I have a waveform chart showing the data. Picture is attached 'data charted in original VI'.

 

I also have the data being output to a TDMS file. It reads at a rate of 1 kHz so 1000 samples per second. This means over the course of a day, it is about 40 million data point (3.6 million per hour) which I cannot open in Excel.

 

As you can see in the original chart it has a nice waveform showing the data. However I would like to possibly use the TDMS file to create a chart like this. 

 

I am trying to read the data in labview as a beginning task. I have created a 'Read from measurement file' and output it to a waveform graph (shown in other picture attached). I have set the read function to read TDMS data and selected my chosen TDMS file in its settings. However when I run the VI, I get an error message. 

 

Do you know what this error message is or why it is happening when trying to read TDMS file?

0 Kudos
Message 2 of 15
(2,107 Views)

Hi lorc,

 


@lorc34 wrote:

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

I am getting this error when I try to run a standard labview example. 


From your image I only can say: don't use ExpressVIs…

 


@lorc34 wrote:

I am using Labview 2007,


There is no "LabVIEW 2007"…

 


@lorc34 wrote:

Even if I open a TDMS file that is small (70 MB) or large (700 MB) it always gives this error. 


  1. Attach the VI used to create those TDMS files.
  2. Attach a (very) small TDMS file of 10s of kB created by this VI.
  3. Attach the VI used to read that TDMS file…

When you do all those steps then we might be able to help you!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 15
(2,089 Views)
I'm on LabVIEW 2016 and I couldn't find that exact example. But, assuming your "TDMS Read" function is similar, there is an input called "data type". By default it looks like it uses waveform data type, but you probably need to wire in something different corresponding to the data in your file.

https://www.ni.com/docs/en-US/bundle/labview/page/glang/tdms_file_read.html#output4
0 Kudos
Message 4 of 15
(2,085 Views)
0 Kudos
Message 5 of 15
(2,079 Views)

Hi,

 

I think I have found a slightly easier way than trying to use the TDMS data to create charts.

 

I found you can right click the waveform chart, then click Create -> Invoke Node -> Export image. 

 

From this you can select a file type and path. This creates an image that I am happy with.

 

However I am running into a problem. When I try to put this in a Case Structure which has a true condition that activates when my program ends (I have it set to activate true when the program has ran for 10 hours which also executes Stop function) it says 'Failed to save image' 

 

I have attached the VI which takes data from the DAQ, writes to TDMS and now also attempts to export images after the program has finished running. 

 

Instead of 10 hours, I have set the program to save images and stop after 5 seconds to make testing easier.

0 Kudos
Message 6 of 15
(2,041 Views)

Hi lorc,

 


@lorc34 wrote:

I have attached the VI which takes data from the DAQ, writes to TDMS and now also attempts to export images after the program has finished running. 


When exporting pictures I would stay away from BMP format, use PNG instead…

 

When building paths you should use path functions, not string functions!

Why do you need to build the same paths in each iteration?

Why don't you use Autocleanup? Why don't you follow the LabVIEW style guide?

Why do you need to multiply your DAQ data by 50? Why don't you apply a DAQmx scale to your DAQmx channels?

Why do you need to multiply them with 1 later on?

Why do you need to format timestamps several times just to calculate an elapsed time? Why not calc current timestamp minus timestamp before the loop?

See this:

 

The main problem with your TDMS files is that overuse of ExpressVIs: using plain functions with plain datatypes would make your VI much simpler and more failproof…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 15
(2,032 Views)

You have cleaned up everything a lot, but the functionality of the code is the same right? Because for me, the code did not actually work. I got an error saying "image cannot be saved" or something. 

 

I will clean it up with the suggestions you mentioned, however given the functionality is not changed, I believe my code will still not work. It seems to be when I put the export image code in the case structure it fails. It works outside case structure.

0 Kudos
Message 8 of 15
(2,006 Views)

Hi lorc,

 


@lorc34 wrote:

You have cleaned up everything a lot, but the functionality of the code is the same right?


I hope it still works the very same way…

 


@lorc34 wrote:

It seems to be when I put the export image code in the case structure it fails. It works outside case structure.


As the case is called upon last iteration of your loop (when stop condition is TRUE) you can move the whole case structure out of the loop! Then you can get rid of the case structure and use simple "THINK DATAFLOW!" to call the InvokeNodes after the loop has finished.

 

See this:

Using two different options to save an image of the chart…

 

Edit: IMHO saving images instead of real measurement data is just clumsy. Most often someone will later on ask for real data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 15
(1,975 Views)

"I hope it still works the very same way…"

 

If it works the same way thats a problem because the VI I sent you says 'error: image failed to save' whenever you run it.

 

I will try put it outside the while loop however that I believe I already tried that and it took a picture of the waveform chart at the beginning of the program which is not what I want, I need it at the end or else it will not show any of the day's data

0 Kudos
Message 10 of 15
(1,946 Views)