04-01-2016 07:20 AM
Hello, I'm very new to LabVIEW, so apologies if I use the wrong terminology.
I have made a VI that reads 25 text files into a 3D array. When I click run I need to select the 25 text files. Is there a way I can save the data imported for later calculations without having to select the files every time?
Here is what I've got:
Solved! Go to Solution.
04-01-2016 07:38 AM
04-01-2016 09:25 AM
I'm making a PV solar assessment tool, whereby the user enters their system information (in this case, Zone in UK, panel inclination, and panel orientation). I need their entry to index this 3D array to find a value for later calculations. The zone corresponds to what I would call the 'sheet' of values (3rd dimension), the orientation corresponds to the column number, and the inclination the row number.
I have 25 small text files, with 10 columns X 45 rows of numerical values. I want the data in saved in LabVIEW so when the user clicks run, they don't then have to enter all the text files themselves. I can get the values in using my VI Iby running and selecting the text files (.txt), but when I close the VI, the values dissappear, I just want them to stay there.
I am at a very basic level, as you can probably tell. But once, I've got this sorted I can repeat for all my other factors.
04-01-2016 10:36 AM
What I would do is when the user enters their zone, you then read the file that corresponds to that zone. You can then use the 2D array as you need. On startup, read from the file for whatever value is in the zone control and you will have the latest. No need to keep a lot of memory hanging around.
04-01-2016 10:42 AM
Thanks for this. But the user will not have access to these files when running the VI. There are lots of other arrays that I will need to save and index for other variables as well, so just the method of you'd use would be handy to know. All I really need is a way of saving these relatively few values into an array.
04-01-2016 11:18 AM
@Dan_Owen101 wrote:Thanks for this. But the user will not have access to these files when running the VI. There are lots of other arrays that I will need to save and index for other variables as well, so just the method of you'd use would be handy to know. All I really need is a way of saving these relatively few values into an array.
Then do you plan on having these values hardcoded in your executable? That sounds dangerous and prone to you having to make updates a lot. Trust me when I say that you want to have the files sitting with the executable.
But if you are insistant on this, I would use a global variable. Have a VI just read all of the files and build the array for you and write to the global variable. Then you can right-click on the control on the global variable front panel and "Make current value default". Save the variable and build your executable.
04-01-2016 12:41 PM
Thanks. The values won't be changing so this is what I needed.
Thanks for your time!