From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-06-2014 04:49 PM
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
Solved! Go to Solution.
05-06-2014 05:20 PM
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,
05-07-2014 02:18 AM
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!