LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save filehistory

Hello !

I am trying to work out a system in which I save my indexed data acquisition
filename history into a config file.
So being independent of time I can ensure that the program always builds a
filename that is unique.
With this want ensure that I wont lose my data.
I have been studying this config file building using the components there
are.
First when I start measuring I have composed a filename and then I have to
read the config file and check if there is already the filename I am going
to use. My problem is that in how to go thru the section where the filenames
are.
For example, I am trying to make data acquisituion with filename data2.dat .
The code checks if it is there. If not then we add it into config file ,
ok.
If the file name ex
ists there then we have add by one the index data3.dat.
Ok, now comes the problem. But if there also exists also data3.dat in the
config file ?
Well, probaly there is a simple brainy solution how to procedure that
situation ?

Any hints available ? 🙂
0 Kudos
Message 1 of 3
(2,388 Views)
It will be simple to look for "data" and keep the value of the greatest related index (while searching into config - for example, you find data2, data3, data5, data4 -> therefore you'll kepp 5), increment that value and create the new name.
another solution is to have an entry in your config file or another file containing the next available index for your data file. Every time you save a data file, increment this value. Even if you want to attach something else to the file name, you will have a different index every time ... so, different names. The file names will be like
00001 - one name.dat
00002 - another name.dat
00003 - one name or another.dat

Hope this helps
0 Kudos
Message 2 of 3
(2,388 Views)
Hi Jack,

The way I usually do is first you do a list of files in that folder (LIST vi is under file i/o, advance) with pattern *.dat in your case. You'll get a 1-D array of filenames. Then you use 'scan from string' to get the integer part of the filename (another 1-D array of integer maybe). Finally you get the maximum for that array and increment by 1 to get your new filename.

hope this helps.

Dan
0 Kudos
Message 3 of 3
(2,388 Views)