04-23-2015 11:35 AM
How can I reed/write arrays in to a ini file? I was trying to do it in a foor loop since the key.vi does not admit a input array. But only the last element is writen in to the file, how can I append new data in to a certain key?
04-23-2015 11:50 AM
Each Key must have a unique name.
Otherwise the ini function will only (appear to ) write the last one.
The value in your case is a string
The keyname is also a string.
as in
keyname=value
04-23-2015 11:51 AM
By the way
saving arrays to an ini file is probably not a great idea, but this is only my opinion.
.
04-23-2015 12:02 PM
Wich is the best way to keep save data to read it back on vi start up? I need to save state of my controls and indicators on shutdown.
04-23-2015 12:04 PM
I ended up doing this:
Using spreadsheet to list the array like: string1,string2,string3, and so on. I need to store a decent amount of data, idk if this will be a good idea.
04-23-2015 12:16 PM
I have found these free VI's to be worth the effort to install them over the long haul.
04-23-2015 12:17 PM
I think I would have just used the OpenG Read Panel From INI and Write Panel To INI functions. They do all of the work for you, including saving of arrays and clusters.
04-23-2015 12:22 PM
Where could I find this?
04-23-2015 02:18 PM
If you installed a recent version of LabVIEW, you should have the VI Package Manager (VIPM) installed. If not, you can download it for free from jki.net. Run it and let it search for Packages. OpenG is about half-way down the list.
To comment on your original post, I've saved Channel information in a Configuration (.ini) file. I had an array of 16 values, one per channel, and needed to make unique Keys. I used the String Functions to create the (unique) keys "Channel00", "Channel01", etc. from the index of the For loop.
Bob Schor
04-23-2015 02:36 PM
If you don't want to save the complete front panel with the OpenG functions, but just some of the some of the control, you could use the XML file functions in the File I/O/XML palette.
You can flatten the array to XML and save it to XML file. At program start you can read the file and unflatten it again.
If you want to save many controls, create a cluster including all the control types, and save the cluster as XML