LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Loadable Preset Settings

Solved!
Go to solution

Hi,

 

I am trying to create loadable preset settings for my controls.  I wasn't sure of the best method so I started by allowing the user to save the preset as a text file.  The problem I am having is how to load the presets from the text file.  I was thinking that I could try Read from Spreadsheet, but a few problems/questions arise from that.

 

Problem #1: My text file has two columns.  For the sake of aesthetics I made it so the data of each column was perfectly aligned (Column 1 contains the name of the control and Column 2 contains the value of that control).  This leaves me with instances where different amounts of space exist between elements in the same row.  I am not sure how to parse the data in each row.  The easiest way I can see would be if i could have an offset per line since my control values are all the same length from the start of the line.  I can't figure out how to implement it, if it is even possible.

 

Problem #2: If I manage to parse the data in the rows properly, I would be left with an array of control values.  How would I go about loading those values into the controls of the VI.  I am not sure how I would do that from an array.

 

I have attached a text file with the formatting I described above to give some reference.  The file contains channel names with "inactive" next to them.  Those are supposed to correspond with 0's, which I figured I could convert to numbers before they were loaded into the proper boolean controls.

 

Thanks

0 Kudos
Message 1 of 3
(2,168 Views)

Hello tbergen,

 

I'd suggest taking a look at the MGI Save/Load Front Panel functions provided in the MGI Library- the functions are straightforward and so are the files themselves if you need to edit them by hand.

 

MGI Library - Moore Good Ideas

http://sine.ni.com/nips/cds/view/p/lang/en/nid/209753

 

Regards,

Tom L.
Message 2 of 3
(2,158 Views)
Solution
Accepted by topic author tbergen1

Hi Tom,

 

Thanks for the response.  I checked out the library and it was pretty helpful.  I ended up figuring out a solution that didn't come directly from the library due to my curiosity.  It is able to read in my files and load the presets to controls.  Thanks for your suggestion!  I attached the VI I made in case anyone stumbles upon this thread with the same problem I had.

 

Thanks! 

0 Kudos
Message 3 of 3
(2,111 Views)