06-13-2012 02:47 AM
Hi,
My vi filled an array inside a loop, and when it is ended then he have to record the array in a lvm file. My problem is that it always overwrite on the same file instead of increment its name as confirured in the 'Record Main.vi'
simplified "Rempli_Global_Vol_Tot.vi' :
Solved! Go to Solution.
06-13-2012 02:56 AM
Peter,
your Record Main.vi contains the ExpressVI Write To Measurement File. This is configured to a static file (C:\Users\Escape\Dropbox\Débit_Mesuré.lvm). Since you are not writing anything to the file using this VI, but only ask for the file path, it is no surprise that you will always get the same file over and over again.
Suggestion:
- Use the Write To Measurement File to write the data.
- Replace Write To Measurement File with code which returns unique file names.
- Possibly (not tested) it is sufficient to add a boolean constant to "Reset" of the Write To Measurement File and set it to "TRUE" (default is FALSE).
hope this helps,
Norbert
06-13-2012 02:56 AM
And when I run "Record_main" alone, he create a different file at the end of each execution. That's how it should work.
06-13-2012 03:01 AM
Thank you for your answers Norbert,
How can I your second suggestion ?
06-13-2012 03:01 AM
I see you are writing to a text file as well to avoid overwriting you have to set the file position before writing to the file. Try the attached example
Write the data into the after setting the file position.
06-13-2012 03:05 AM
I understand that he wants a new file each time with an unique name (e.g. with increasing number in its name).
Is that correct?
Norbert
06-13-2012 03:07 AM
Yes you're right Nobert !
06-13-2012 03:12 AM
Peter,
to implement your own code for unique file names, you have to use the "Check If File Or Folder Exists.vi" from the advanced file io palette:
Depending on its result, you will count up, check again and so on and so forth....
You would pass the first "free available" file name to your Write To File function.
hope this helps,
Norbert
06-13-2012 03:16 AM
Thanks Nobert but I'm a new user of Labview so i'm not sure to understand how I can add this function to my vi,
can you show me how can I do that please ?
06-13-2012 03:44 AM
Peter,
the code would look similar to this:
Norbert