LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save all variables state for next execution

Hello everybody, I am trying to save all the variables values of my Main VI in order to have the exact same state (same settings, devices addresses, array or enum values and so on) on the next execution of the program.

My idea is to analyze each variable reference and to save its state (variable name+value) in a text data before the program is closed (or for example every 10 minutes).

The problem is that some of my programs have a complex structure (for example a Register Tab with an Array of Clusters with Arrays inside the cluster) and the subVI I developed is getting more and more complex (and I'm not scalable enough) so I am here to ask for ideas in order to reach my goal.

 

So far I developed a simple subVI that according to the Reference ClassID converts the reference to it's specific type and converts the information (variable name and variable value) to a string, and this works for Strings, Numeric, Boolean and Enum. When I have a Register Tab I analyze each page reference and the references in it, when I have an Array of something simple I run the SubVI, but when the element in the array is a cluster I have to analyze each element through my subVI and so on and so on.

As you can see the complexity grows very fast and I think recursive VI is probably an option (but I don't know how to develope it in my case).

Last but not least I have to find a way to code all those strings that describe the values so that I can read them and set all the values back.

 

I hope you can help me!! Thanks in advance!

 

Dario Cassaniti

0 Kudos
Message 1 of 3
(2,688 Views)

There's actually already a VI in OpenG that can be used to read and store all front panel controls as a variant in a .ini file.



0 Kudos
Message 2 of 3
(2,659 Views)

The 'Flatten to xml' and 'Unflatten from xml' vis work well with complex data structures (clusters of arrays of clusters, etc.)

0 Kudos
Message 3 of 3
(2,644 Views)