09-01-2010 10:22 AM
I am using a cluster as a control. I would like the double values in that control to automoatically populate to their last set values when the VI is opened or accessed for the first time. It would be great if someone could point that out to me. Thanks in advance!
Solved! Go to Solution.
09-01-2010 10:29 AM
Here's a relatively simple and extensible example.
09-01-2010 10:34 AM
There are many ways to do this. The most common way is to use the configuration VIs in the File palette.
You can always just do Edit>Make Current Values Default and then save the VI. Of course that will only work in Development mode. If you want to do this for an executable you have to use the configuration VIs and write to an INI file or save to XML, etc.
09-01-2010 10:35 AM
09-01-2010 10:52 AM
The link worked for me when I just tried it. I contains an interesting dicussion regard methods for saving the settings of front panel controls, although some of it may be a bit dated as it was from 2007 and some of the concerns regarding the OpenG tools mentioned have been addressed, at least up to LabVIEW v8.6, I haven't tried them for v2009 or v2010. They work very nicely (the OpenG tools) and handle a variety of controls that my previously self developed solution didn't handle well, like typedefs and arrays. The tools will take a reference to a cluster control and either create or read back an ini type file.
09-01-2010 11:51 AM
In my opinion, configuration files are the easiest and best method. Just save your last values to the file when your code ends. At the beginning of your code, read the file and populate the controls with the values read. With config files, the section name can be the cluster name, and the key names can be the control names.
I know OpenG has some pretty nice VIs to do this, but I would rather use NI native functions when I can. When porting to a new system, there is no need to copy any extra library of VIs (OpenG library). The native VIs come with Labview.
09-01-2010 12:20 PM
Thanks much! That was very helpful.
09-01-2010 02:26 PM
@tbob wrote:
In my opinion, configuration files are the easiest and best method.
Easiest? Maybe, if you only need to do this for one control. I contend that I could probably recreate my saving and loading VI from scratch (without any OpenG code) and get it to work for N controls faster than you (or at least I) can write code which will save and load 2 or 3 controls.
Best? Certainly not. Once you have the VI, it's scalable up to N controls and M VIs even if you don't use the OpenG VIs internally. The OpenG VIs simply allow easy access to the values through an ASCII editor, but the VI works fine without them.