Jump to content

Two 1d arrays as XY graphs save to TDMS


cpipkin

Recommended Posts

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.

 

xy-vs-waveform.PNG

 

 

Codeshot.PNG

TDMS Waveform Example.vi

Edited by cpipkin
Included a VI & Pictures have been updated to better represent my code.
  • Like 1
Link to comment

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

  • Like 2
Link to comment

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.

 

Codeshot.PNG

TDMS Waveform Example.vi

Edited by cpipkin
vi updated with more clear labels
  • Like 1
Link to comment

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

  • Like 2
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.