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.
06-14-2013 09:22 AM
Hello,
I'm having a problem getting some string constants I have defined in a global variable file to stay saved in the file. I'm guessing I may be doing it incorrectly but I basically want these string variables to stay constant in the global file, right now I'm using a string control to define them. The problem with this is that these values get wiped everytime I close out Labview. I've attached my global VI.
Thanks,
Konrad
Solved! Go to Solution.
06-14-2013 09:44 AM
If they clear you must have some function that writes to this file with empty values.
Attaching the Global doesn't help much, the main vi would be better. 🙂
/Y
06-14-2013 10:06 AM
Right click the global, select find all instances. Look through the find window and it should say if the different instances are read or write. Double click any that are "write" to see where they are being written to.
06-14-2013 10:10 AM
The values in the global are only there until the global leaves memory. This is true of all VIs, not just globals. If the values will never chnage, use Edit > Make Current Values Default on the Global 1.vi front panel. Then save the VI. If you need to change the values in yout main program, then you should write the data to a file before closing your program and read the data from the file as soon as the main program begins executing.
Lynn
06-14-2013 10:10 AM - edited 06-14-2013 10:17 AM
There may be a better way to do this, but off the top of my head, you could scrap the global if it's really read only. Create a cluster with all your constants and put it in a lvlib. Set it to private. Create a public read accessor for it to be used throughout yoru code. I guess you could stil change them locally in this case once a copy was gotten from the function, but you couldn't write back to the actual global instance.
06-14-2013 10:14 AM
Lynn,
Thanks, this is what I was trying to do. I wanted to avoid extra definitions in my main vi itself.
Konrad