LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

incrementing variables

how do i increment a variable so that labview stores that value for the next time labview is opened.  thus far, everytime i increment something, the value goes back to initial as soon as i close labview and open it again. 
0 Kudos
Message 1 of 9
(2,718 Views)
You should write your last value to a configuration file, then read it next time the program starts.

Message Edited by altenbach on 05-24-2006 11:54 AM

0 Kudos
Message 2 of 9
(2,714 Views)
do you mind expanding on how you write to a configuration file?
0 Kudos
Message 3 of 9
(2,709 Views)
OK, open your example finder and search for keyword "configuration ". Have a look at the two examples:
  • Read Configuration settings file
  • Write Configuration settings file

(This assumes that the desired value changes between runs. Of course if the value of a control should always be the same, make the current value the default before saving the VI)

0 Kudos
Message 4 of 9
(2,705 Views)
You could also try the *very lazy and poor form* way, of just setting the incremented value to the default ("make current value default") before exiting.  However I would recommend Altenbach's way.
0 Kudos
Message 5 of 9
(2,693 Views)


@Novatron wrote:
You could also try the *very lazy and poor form* way, of just setting the incremented value to the default ("make current value default") before exiting.



Well, this method only works if the VI is not running, thus you cannot do it programmatically from within the VI.

Even if you do it manually after the VI stops, you also need to save the VI with the new defaults before quitting LabVIEW.

0 Kudos
Message 6 of 9
(2,685 Views)
Please find attached VI as a reference 🙂 Hope it helps!
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 7 of 9
(2,671 Views)
Not having LV in front of me I can't confirm this, but is there not a property node that enables you to "set current value to default" for most controls?  Would that not work during runtime?
0 Kudos
Message 8 of 9
(2,666 Views)
To be precise, method "Make current values default" is at the VI level. This method is not supported by the runtime engine, moreover it cannot be called if the vi is running.

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 9
(2,655 Views)