cpipkin Posted February 3, 2017 Report Share Posted February 3, 2017 (edited) Hello I am trying to save TDMS files that ideally contain the following: - 3 xy graphs (each containing two 1d arrays) - 1 waveform The problem i'm running into is that when I convert the xy graphs to waveforms, the x-axis is converted to time, which isn't real or useful to me. I've attached screenshots of what the XY graph should look like VS what it ends up looking like with the waveform. How to I make sure the x-axis is preserved so that I can save to TDMS? Edit: VI is included & pictures have been updated to better represent my code. TDMS Waveform Example.vi Edited February 3, 2017 by cpipkin Included a VI & Pictures have been updated to better represent my code. 1 Link to comment
hooovahh Posted February 3, 2017 Report Share Posted February 3, 2017 Using things like the dynamic data type, and express VIs is going to be your down fall. These functions work fine for the majority of the use cases, but having more low level control gives you the features you'll want. In this case I see a couple of issues where you are trying to provide an array of delta times where this should be a scalar value stating the amount of time between samples. This information needs to be recorded in the TDMS file and using the TDMS write primitives do this. That is why the time scale on your graph above is samples since the delta time between samples wasn't recorded, likely because the Write to Measurement File didn't know that meta data was there, since it is write a dynamic data type. Attached is an example of writing and reading a waveform with TDMS. Write Read TDMS Waveform.vi 2 Link to comment
cpipkin Posted February 3, 2017 Author Report Share Posted February 3, 2017 (edited) Hi @hooovahh! Thanks for the feedback. I used that express VI just to make a quick example. I've attached a more representative version of my actual code. I've included the read TDMS of your code. What do you think? Is there a way to preserve the X-Axis in the TDMS file? If not, any other approaches? I would like to be able to preserve as much data as possible in 1 single file. TDMS Waveform Example.vi Edited February 3, 2017 by cpipkin vi updated with more clear labels 1 Link to comment
hooovahh Posted February 3, 2017 Report Share Posted February 3, 2017 Ohhh! This is a different issue all together. You don't have a Waveform Graph, you have XY graph. A Waveform graph has every sample be the same distance apart, where XY it is arbitrary. Attached is an updated version where we write three channels, one for the X one for Array 1 and one for Array 2. Then when we read we read all values from all three channels, then build them back into a bundle of X and Y values. I also built that into an array so one XY Graph can show both plots but you may want that on separate plots. TDMS Waveform Example 2.vi 2 Link to comment
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now