LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i create a counter that changes a number 1 without using structures

How can i create a counter that changes a number 1 without using structures?
------
i want to make a filename that when i push a button it automaticly goes to figure1.bmp and when i push again it goes to figure2.bmp.

Tnx alot,
Tristan
0 Kudos
Message 1 of 2
(2,354 Views)
I'm not really sure what you mean by "without using structures". Do you mean that the VI will be run once and the file will be created and then run again and an incremented file should be created? Or do you mean that the VI will be looping (perhaps with an event structure) and that you don't want to use any other structures.

For the latter, you just add a shift register and increment a number that you then attach to your file name.

For multiple single runs, you could store the file number in an ini, read it, increment it, use it and save the new number. Or you could get a list of the number of files in the directory and use that number as the number you add to the filename. This works best if you only store your data in that directory, and you
don't remove them until you are finished. This way of doing it is attached. Another thing you can do is to get the list of files, strip off the numbers, take the largest, increment it and use that. That way you could have other files in the directory as well.

I am sure that there are others, but these are the things I thought of off the top of my head.

I hope that this helps!
Bob Young
Message 2 of 2
(2,354 Views)