LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to design to save and reload arrays

Hello, I have attached my VI below.

 

If you look at the VI, I have 2 numeric arrays that the user inputs data into ("Setpoint Temperature" and "Duration"). What I want is to design something that after the user inputs all the data, the user presses a "save button" and both arrays are somehow saved somewhere with a custom name the user inputs. Then, even after the VI is closed and opened again, there would be a drop-down menu and the user can select the name of that "file" which would initialize the arrays with the values of that file. 

 

I am relatively new to LabVIEW and have tried looking at different resources but have not had any success yet... Does anybody have any idea how to approach this? Keep in mind any save feature / drop-down menu that I discussed are nonexistent in my file as of now.

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

Hi laps,

 

there is a palette full of file functions.

And there are function which let you easily save and load array data (named someting with "DelimitedSpreadsheet")…

Did you try to use them?

 

the user presses a "save button" and both arrays are somehow saved

To react on a (boolean) button you can use a case structure - or an event structure…

 

there would be a drop-down menu and the user can select the name of that "file"

Use a ring (while I prefer Listbox controls to allow the user to select from a list of options).

Fill the ring (or the listbox) with all those filenames available to your program - I guess you want to store such files in a special "configurations" folder. Then handle the user request again using a new case in your event structure…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,548 Views)

First, rewrite the code as a state machine. Loop times of minutes to hours are just pointless. If you just want to retain the last values between runs, create e.g. an ini file that, if present gets read when the program starts and updates the array controls (via local varables). Write the last values when the program is done. Create a mechanism to reset to defaults or manually re-save after the controls contain good values. Note that once your loop runs, changes to the array controls are ignored. Probably not desirable.

As I said, create a full program architecture that can deal with all operator actions appropriately.

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