06-18-2013 11:06 AM
I have a LabView code in which the first time the user has to enter a set of values through a wizard ( a separtate VI ) and go ahead. What I want to do is have a separate button on the main VI which will take in the default values ( or previously entered values ) of the wizard and directly go ahead without even popping up the Wizard VI
Thanks
06-18-2013 11:37 AM - edited 06-18-2013 11:38 AM
You'll need to store these values somewhere. I like to use the OpenG configuration file VIs for this.
Make a cluster that defines the data in the configuration (ini) file, open it, read it, (convert the variant and) close it and Bob is your uncle.
06-18-2013 12:16 PM
Hi Jim
The wire coming out of the Wizard VI is in cluster form ( pink wire ). How do I write it to file and later refer to that storage for further use. Also could you please keep it a bit simple as im a new to it. Thanks
Soham
06-18-2013 12:54 PM
The very simple way would to use the Write To Binary File and Read From Binary File. These two functions will accept your cluster. If resultant file likely won't be readable using a text editor, in case that is a requirement.
06-18-2013 01:12 PM - edited 06-18-2013 01:14 PM
@Soham wrote:
Hi Jim
The wire coming out of the Wizard VI is in cluster form ( pink wire ). How do I write it to file and later refer to that storage for further use. Also could you please keep it a bit simple as im a new to it. Thanks
Soham
Do steps 1, 2, 3 and 6 to create the file. Do steps 2, 4, 5 and 6 to read from it later.
I can never remember how to format the configuration file, anyway, so I make a VI do steps 1, 2, 3 and 6 when I begin a project. I always make a Type-Defined cluster, too.
Contents of created ini file:
[Sample Ini Data]
String Data = "Hello, World!"
Boolean Data = "FALSE"
Integer Data = "25"
Float Data = "2.710000"
Arrao-O-Stuff.<size(s)> = "1"
Arrao-O-Stuff 0.More Boolean Data = "TRUE"
Arrao-O-Stuff 0.More Integer Data = "10"
Arrao-O-Stuff 0.More Float Data = "3.140000"
06-18-2013 01:22 PM
@crossrulz wrote:
[...] resultant file likely won't be readable using a text editor, in case that is a requirement.
This is a good point; you may have a requirement that the file not be human-readable/editable. I want my stuff to be readable in a text editor and I just use OS permissions (and threats of retribution) to prevent unauthorized access.
06-18-2013 02:48 PM
Thanks Jim
Though can you explain how do I make a config file? Im really new to labview. Also could you tell me what this means (the picture attached)?
06-18-2013 04:02 PM
Look under the File palette -> Configuration file subpalette.
If you want to make it (decently) human readable with little work you'll read and write the config-cluster with as XML instead. 🙂
/Y
06-18-2013 05:10 PM
@Soham wrote:
Thanks Jim
Though can you explain how do I make a config file? Im really new to labview. Also could you tell me what this means (the picture attached)?
My last post tells you how to make the config file. The picture you attached is of an enum or a ring constant.
06-18-2013 05:11 PM - edited 06-18-2013 05:13 PM
@Yamaeda wrote:
[...]
If you want to make it (decently) human readable [...]
Right!