LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving the clusters as default settings

Solved!
Go to solution
Dear all,
I am stuck in a small problem and need a bit of Help from you.
In my application, i have a subVI which will take the necessary settings from the user to run the program. These settings i want to store it in a File(or in any other format) so that when the user restarts the program, the saved settings gets updated on the Settings SubVI.
The Settings SubVI consists of Clusters which includes Radio Buttons, Enums, Rings, etc.

I am attaching the Front Panel Pic of the Settings VI.
Pls have a look at it and let me know how can i save these settings in an efficient way.

Thanks,
Ritesh
0 Kudos
Message 1 of 11
(3,399 Views)
Solution
Accepted by topic author LVCoder

Hi Ritesh,

you can write your own function to read and write the data or you use the "Flatten to XML" and "Unflatten from XML" to store and restore your data.

 

Mike

Message 2 of 11
(3,395 Views)

Hi Mike,

Thanks alot.

"Flatten to String" and "Unflatten to String" works great.

 

Ritesh

0 Kudos
Message 3 of 11
(3,376 Views)

Hi Mike,

Though Flatten and Unflatten to String works great if i store the data in a Text File.

But, its not giving the correct result when i am saving the same string ina Binary File.

 

I am atacing my code here. There are 2 clusters. The program first stores Cluster1 to the Binary File, and the reads the same file and O/P the data. The I/P data and the O/P doesnt match in this case .

 

Pls have a look at it and let me know whats the cause ?

 

Thanks,

Ritesh

0 Kudos
Message 4 of 11
(3,364 Views)

I forgot to attach the control to my previos post.

i am attaching it here.

 

 

Ritesh

0 Kudos
Message 5 of 11
(3,362 Views)

Hi Ritesh,

with some changes it works for me.

 

 

Mike

Message Edited by MikeS81 on 02-11-2009 02:02 PM
Message 6 of 11
(3,360 Views)

Hi Mike,

After amendments, I am still not getting the correct O/P.

 here's the O/P i got.

 

Ritesh

0 Kudos
Message 7 of 11
(3,342 Views)

Hi Ritesh,

connect also a "false" to the "write to binary" function.

 

Mike

Message 8 of 11
(3,338 Views)

Hi Mike,

Thanks alot.

Its working now.

 

Ritesh

0 Kudos
Message 9 of 11
(3,336 Views)
In the interest of full disclosure, you should know that the flatten/unflatten solutions are relatively brittle to change.  If you change your clusters in the future, you need to keep the old datatypes around so you can read old files.  Even though it takes longer, it is more maintainable to explicitly read and write each element in your clusters.  The configuration file VIs or TDMS work well for this type of thing.  You can also use HDF5, XML, or any other hierarchical file system.  LabVIEW 8.6 and higher includes a generic XML parser.  Which you choose depends on your requirements.
Message 10 of 11
(3,311 Views)