ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reconstruct cluster from TDMS

Solved!
Go to solution

I've been able to successfully save my array of cluster data to a TDMS file using the following block diagram:

Save Data.png

I've been trying to reconstruct my data using the following block diagram:

Load Data.png

When the program gets to the nested FOR loop, it never enters. I placed a probe on the data going into that loop and there is certainly a large array going into it. Does anybody have any ideas for me? Furthermore, should I try a different method to save and restore data? (It seems like TDMS isn't very friendly unless you give it waveform data)

 

Thanks for any help!

0 Kudos
Message 1 of 5
(3,841 Views)
Solution
Accepted by topic author nickb34

Hi Nick,

 

The number of iterations in the for loop is determined by the smallest array- in this case I would hazard a guess that your cluster definition array (DataArrays.PeakDataArray) is empty- the auto-index input is going to see zero elements and skip the loop.

 

You'll want to index that array one loop out to provide the cluster definition.

 

*edit*: By "one loop out", I mean you'll need to use an index array function, preferably outside the outer for loop- you don't want to auto-index just to get the cluster definition.

 

Regards,

Tom L.
Message 2 of 5
(3,837 Views)

Tom,

 

You sir are correct... I had done that previously for breaking out the waveform signals, but missed it on this one.

 

To my other question, is there a better method for saving and restoring clustered data?

0 Kudos
Message 3 of 5
(3,826 Views)

Hi Nick,

 

Datalog files might be what you're looking for.  They are extremely convenient when storing small-to-moderate amounts of cluster data, but there are a few caveats:

 

1) You're essentially creating a custom binary file type that is only interpretable using your definition cluster and the datalog functions - this means data export to other environments/programs will be difficult and probably have to go through a datalog interpreter and you'll need that cluster definition to unpack the data.  This makes most datalog solutions application-specific (It's hard to re-use the code elsewhere).

 

2) The file size is currently capped at 2 GB

 

3) See (1).  You can't open a datalog in Excel.

 

There are a few decent examples of the functions being used, such as this one:

 

Example: Super Heroes vs Super Villains (an intro to Datalog Files)

https://forums.ni.com/t5/Example-Code/Super-Heroes-vs-Super-Villains-an-intro-to-Datalog-Files-Using...

 

XML is another good (and more portable) option, but will probably require more time up front to get going.

 

I've seen a few different cluster pack/unpack tools around, one called "Read Anything" is included in the free MGI library and saves cluster data in config (text) files.

 

Regards,

Tom L.
0 Kudos
Message 4 of 5
(3,815 Views)

Modify the inner loop, let it build an array and place the build array outside and afterwards and add the two arrays together.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 5
(3,766 Views)