LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Polymorphic Data to TDMS

Solved!
Go to solution

 

Hi, I have an array of 8 elements, each containing a timestamp, double and integer (as shown below).

 

I cannot get this array to log into TDMS. Is there a trick to doing this? TDMS seems to want the constant shown below?

downerdce_1-1625259254813.png

 

 

0 Kudos
Message 1 of 5
(1,641 Views)
Solution
Accepted by topic author downerdce

We can't debug a picture. Please post your code if you want to demonstrate something.

 

The data type you have there is the "Waveform" data type, which contains a timestamp, a dt value, an array, and an attributes variant. Ignore the last one for now- it's optional.

 

The Waveform datatype is used for periodic data. The Timestamp in there is when the dataset was started. It's technically optional as well, though it can be helpful. The dt value is the time step between each successive sample. For example, a 10 Hz signal would have a dt of 0.1. The array is the actual sampled data.

 

You said you have a timestamp, double, and integer. If you're taking data at a constant rate, I'd recommend using a waveform datatype as it's quite handy. If you're taking data at a non-constant rate (like, say, every time the user clicks a button or something) you'll need to store the data separately.

 

If you open the Help file for TDMS Write and scroll to the "data" section, you'll see it can take an input of a waveform datatype, array of waveform datatypes, some digital stuff, and 1D and 2D arrays of numbers including timestamps.

 

With your data you should be able to go about this in a few different ways. The first, and simplest, method is to just convert everything you have there to a double value, and write it all as a 2D array. If you want to get a little more advanced, you can just use multiple TDMS Write functions, each writing a single array of each datatype, with your Channel Name set to something different each time. You should then be able to read out each of your channels as 1D arrays. This is probably the better choice as it preserves the "intent" of your data and you don't have to move a bunch of stuff around. Last, assuming you have constant-period sampling, you could change your data to be of Waveform datatype and can write an array of Waveforms.

Message 2 of 5
(1,606 Views)

Thank you, I did get it working finally. I had to basically take those clusters and split them out to arrays them send the arrays out the to the TDMS.

 

downerdce_0-1626105067592.png

 

0 Kudos
Message 3 of 5
(1,568 Views)

I'm not seeing a point in the Array To Cluster.  You could just use Index Array to get the clusters you want.  Or, even better, just autoindex a FOR loop and parse each element building array(s) on the output that you can then wire to the TDMS Write.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 5
(1,564 Views)

What crossrulz said!

 

array.png

0 Kudos
Message 5 of 5
(1,549 Views)