LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to add a counter for the program

I want a counter which can counter the times of running the program.
like every time when i run my program,:i=i+1

how to realize it?thanks a lot!
0 Kudos
Message 1 of 3
(2,811 Views)
Simple:

in your vi, write a value to a file (can even be a text file). For instance, if using text file, open it, write 0, and save it (call it something like runcount.txt)

Every time you run your program, open your file, read the value, increment the value (if string convert to number first), and store it to the same file. DO NOT append to file because you will store a whole bunch of numbers. If you do not append, it will write over your value and you'll only have one number.

You can use an Excel spreadsheet or other means as well..

I tried to keep it simple.

JLV
Message 2 of 3
(2,811 Views)
apart from JLV's suggestion, you might wanna look into possibility with [Configuration File VIs] under File I/O.

Help: Examples > Fundamentals > File I/O

I have been using Configuration File VIs and it is neat and great.

Cheers!
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 3 of 3
(2,811 Views)