LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing xy data to tdms file

Hi,

I would like to write data to be plotted on an xy graph into a tdms file. I have done this by using a write to tdms data vi and then adding then building a 2d array with the y-axis and x-axis values as two individual rows of the array. The problem now is that I cannot view them with the tdms file viewer. I have also tried to create a waveform. This works, but the only thing is that in a waveform the x -axis points have to be equally spaced, like 1, 1.5, 2.0. I my application, the x-axis points are not equally spaced like this. Does anyone have any suggestions for saving data to plot in xy graphs into a tdms file.

Thank you
0 Kudos
Message 1 of 15
(8,365 Views)
There's currently no built-in way of displaying that kind of data in the TDMS Viewer. It's not going to be terribly hard to add it though. The viewer and its subVIs are in .\vi.lib\utility\tdmsutil.llb. You would basically need to make some changes to loadAndFormatValues.vi. The code is fairly well structured and none of it is password-protected or something.

Herbert
Message 2 of 15
(8,358 Views)

I found Herbert's reply (thanks Herbert!) to this message, since I need an xy plot capability and started using tdms for data storage.

"There's currently no built-in way of displaying that kind of data in the TDMS Viewer. It's not going to be terribly hard to add it though. The viewer and its subVIs are in .\vi.lib\utility\tdmsutil.llb. You would basically need to make some changes to loadAndFormatValues.vi. The code is fairly well structured and none of it is password-protected or something. "

 

So I took his advice.

 

I have copied and modified the tdmsutil.lib code to insert an XY Multi plot in place of the wavefrom graph - not "terribly easy" for a non-expert but I'm starting to get it to work. One problem is that there is one password protected vi, "panelResize.vi". I'm not sure what it does other than the obvious from the name. The vi has no outputs, and the inputs are an "Event Data Node" cluster (not sure where it comes from) and a "Control refs" cluster that I I have modified to iinclude the XY polt (Instead of the waveform graph) which is now incompatible with the vi input. I created a dummy cluster just to get the vi to run, but the resize is non-functional.

 

If I can't get a non-protected version I'll probably just delete the entire Panel Resize Event.

 

Suggestions??

 

Thanks,

Brian

0 Kudos
Message 3 of 15
(8,090 Views)

This VI is password protected, because it contains a node that is not documented for end users (sorry for that). In order to help you out, I have modified the VI so it now takes a "GraphChart" reference instead of a "waveform graph" reference. "GraphChart" will accept references for both waveform and xy graphs, so you should be able to use the VI now. Take a look at the attached picture for the changes to the TDMS File Viewer.

 

Hope that helps,

Herbert 

Download All
Message 4 of 15
(8,074 Views)
 
Message 5 of 15
(8,050 Views)

(Wierd - my first post was blank)

 

Great reply! It fits perfectly!

I'd give you 5 stars, but I cannot figure out how to rate a reply! (Maybe I am not worthy??)

 

Many thanks,

Brian

0 Kudos
Message 6 of 15
(8,046 Views)

Hi Brian,

 

can you post the VI of your tdms-viewer (including the modifications suggested by Herbert)?
I am new to Labview programming and even thought the modifications posted by Herbert seem very simple to implement, I still can't make them work (I have problems with the "LoadAndFormatValues.vi").

 

Thanks,

Chr

 

0 Kudos
Message 7 of 15
(7,992 Views)

Sure - here is the latest.

 

This is an example of great programming - NOT!!

I took the existing lib, removed the stuff I didn't need, and renamed the rest (adding XY to the names) to avoid confusion amd make sure I was loading my vi's. Then I modified the vis where necessary.

 

I'm not that proficient at LV, so there are still a lot of issues with this:

- It doesn't work smoothly, e.g. you need to re-select the xAxis and re-plot at program startup. In fact, you need to re-plot anytime you change any xAxis selection - I need to automate this

- In spite of Herbert's addition, the resize doesn't work right since I have added the plot selector panel - I don't really need resize (yet) so I haven't pursued it.

- it's designed to hide the xAxis-value plot automatically - works most of the time... (it's always a straight line anyway)

- It should plot up to 48 values (arbitrary cutoff) - untested - no way to select parameters within a group if you have more than that. This is one addition I wanted to add, but couldn't figure how to make multiple selections in the File selection window.

 

I included my sample tdms data file - plotting works with this data, but I haven't tested with any other data source, so you are on your own there.

The normal xAxis value for this data file is a time value in seconds (vTime). If "vTime" is the selected xAxis label, the scale units are Time, otherwise Engr Units.

 

I got this to where it does what I need for this data set, but it needs work to clean it up and make it a more universal program. I think it would be a great to have this capability in the LV downloads, since most of my data is XY type, not fixed waveform data. Any LV experts want to fix it and and add to the downloads??

 

I re-packaged this lib to send out, so let me know if something messed up. 

Brian

0 Kudos
Message 8 of 15
(7,981 Views)
Awesome! Exactly what I was looking for... :smileyhappy: *****
:. LV2010 SP1 ... W7 .:
0 Kudos
Message 9 of 15
(7,821 Views)

Hmm, same problem different control type desired. 

 

Was the unreleased node in "panelResize.vi" ever released (I'm using LV 8.5.1)?  I am looking to use the "File Viewer" with a single modification: change the Selection Mode of the Tree Control, "File contents", from "0 or 1 item" to "0 or more items".  This mode is an attribute of a tree control and will require a similar hierarchy customization for the modified use case.   

 

I am working on using the File Viewer in a subPanel control so that the user can select one or more items and preview the data for a print dialog.  The panelResize event only tracks its own panel resize. When it is loaded in a subPanel control, changing the panel size of the top-level VI do not propagate into the subPanel version of "TDMS - File Viewer.vi".

 

TDMS Report Viewer Custom Dialog.PNG

0 Kudos
Message 10 of 15
(7,517 Views)