LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

My vi always overwrite on the same file

Solved!
Go to solution

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' :

 Sans titre.JPG

Peter.

Labview 2010
Download All
0 Kudos
Message 1 of 10
(3,671 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 10
(3,663 Views)

And when I run "Record_main" alone, he create a different file at the end of each execution. That's how it should work.

Peter.

Labview 2010
0 Kudos
Message 3 of 10
(3,662 Views)

Thank you for your answers Norbert,

 

How can I your second suggestion  ?

Peter.

Labview 2010
0 Kudos
Message 4 of 10
(3,656 Views)

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

 


File Overwrite.PNG

 

Write the data into the after setting the file position.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 10
(3,654 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 10
(3,650 Views)

Yes you're right Nobert !

Peter.

Labview 2010
0 Kudos
Message 7 of 10
(3,648 Views)

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:

 

CheckIfFileExists.png

 

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 8 of 10
(3,646 Views)

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 ?

Peter.

Labview 2010
0 Kudos
Message 9 of 10
(3,641 Views)
Solution
Accepted by topic author Peter Saraiva

Peter,

 

the code would look similar to this:

 

CreateUniqueFilename.PNG

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 10 of 10
(3,633 Views)