MORECHEMISTRY.COM::MORE CHEMISTRY ON THE WEB |
LabVIEW programming topics - Using indexed arrays in ini files
[LabVIEW vi collection]
[LabVIEW links]
[LabVIEW bookstore]
[programming topics] [drivers] [device simulators] [utilities] [projects] [events] [related topics] IntroductionLabVIEW provides a convenient way to read single data elements from and to write single data elements to ini (config) files. However, for a series of similar data elements, e.g. an array, you should create some method of your own. The presented method assumes you want to use the following type of data in your ini file: [section] In other words all data elements of an array are stored as a separate key. These data elements may represent numerical values, booleans, or strings as in the following example: [sample section] Solution for reading the ini fileThe general approach is to find all the keys in a given section and to compare the found key names with a given key name without number (index of the array). Solution for writing the ini fileThe general approach would be first to clear all the keys with a given name (followed by a number or index of the array) in a given section and next to write each data element of the array in that section with the key existing of a given name and the index of the element.. ImplementationThis method requires a separate function for each data type. Fortunately LabVIEW offers a method to store all related funtions in a single library and a method to combine similar functions in a polymorphic function. Sample programThe sample program shows how to read/write values from an array of doubles and an array of Booleans. Downloadsini file support - indexed arrays.zip which includes:
Remarks
Bart Boshuizen, 2011/02/28 |
|