LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save array of clusters in tdms file

Hello,

I have 1D array of cluster and I want to write the data to a tdms file.Cluster contains numeric constants and enums.Can you suggest a method to do that?

0 Kudos
Message 1 of 15
(4,079 Views)

as far as i know, you cannot write clusters directly to TDMS.

but what you can do is to have a for-loop in which you unpack your cluster and write each member to a different channel.

 

 

example: https://decibel.ni.com/content/docs/DOC-13118

 

hope that helps


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 2 of 15
(4,064 Views)
Message 3 of 15
(4,062 Views)

What type of cluster are you trying to write? Also what is the requirement to save the data in TDMS file format? 

-----

The best solution is the one you find it by yourself
Message 4 of 15
(4,057 Views)

If all the data in the cluster is numeric, then unbundle and build an array from the values. You can write the array to the tdms file.

Message 5 of 15
(4,052 Views)

Another thought - I know you specifically asked for tdms, but If your data is one-off type data rather than continuous data-logging type data, you can write to an xml file instead. Labview will flatten and unflatten any data type to an xml string. You could even write the xml strings to a tdms file if you want!

Message 6 of 15
(4,048 Views)

@Stuart.Parkinson wrote:

Another thought - I know you specifically asked for tdms, but If your data is one-off type data rather than continuous data-logging type data, you can write to an xml file instead. Labview will flatten and unflatten any data type to an xml string. You could even write the xml strings to a tdms file if you want!


Oh I like this solution, you can use XML, JSON, or NI's flatten to string then write that as a sample in each channel.  Wonder if you can do a MGI to INI or from INI as well.  Then at least the data can still be human readable in each channel.  Not that XML isn't human readable but it can be more difficult to view as text than an INI.

Message 7 of 15
(4,025 Views)

@Stuart.Parkinson wrote:

Another thought - I know you specifically asked for tdms, but If your data is one-off type data rather than continuous data-logging type data, you can write to an xml file instead. Labview will flatten and unflatten any data type to an xml string. You could even write the xml strings to a tdms file if you want!


The OP did specify a 1D array.  So it sounds like it is a streaming type data.

 

For this, I would recommend the FOR loop (autoindexing on the array), unbundle the cluster and autoindex the data out.  Then write each array to the TDMS file.


GCentral
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
Message 8 of 15
(4,015 Views)

Can you guys suggest me how the save the  array of clusters into tdms.Please find sample attached vi

0 Kudos
Message 9 of 15
(3,946 Views)

just an example .. read up on the documentation

 

http://www.ni.com/tutorial/9334/en/

http://www.ni.com/white-paper/3727/en/

 

tdms-snippet.png

 

EDIT: couldnt add the .vi 😞 .. but drag and dropping the snippet should still work


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 10 of 15
(3,929 Views)