03-14-2013 08:45 AM
I have a Producer consumer loop that is reading in data from a Excel File call sample1. There is a third party software that constantly writes data to the same excel file Sample1 every _ amount of seconds. Every time the Third party software writes it will over write the excel file data. So it may only be 5 columns and 3 rows.
1. I need to make sure that there is not a conflict when the Third party software has the file locked to read and Labview is trying to read.
2. I need to make sure that if labview isn't reading and reading before the Third party software writes so basically i need some way of checking labview isnt reading the same data twice i need to make sure the file has been updated before it tries to read again. The problem comes in when you can't regulate the time that the third party software reads.
Solved! Go to Solution.
03-14-2013 08:52 AM
You can try something like this in a loop:
It looks at the file and when it sees its modification time changed (meaning something was written to it) it copies it (so that you don't touch the shared file) and then it reads the data from the copy.
03-14-2013 08:53 AM - edited 03-14-2013 08:54 AM
I've had to write code for similiar applications. It is tricky.
Have a look at the .NET FileSystemWatcher.Changed Event. This might be a good way to monitor what is happening with the file.
Take a look at this post: http://forums.ni.com/t5/LabVIEW/My-First-Nugget-Directory-Changed-Event/m-p/1407552/highlight/true#M...
03-14-2013 08:55 AM
tst Thanks for that quick reply.
would i do this in my producer loop? do i remove what i currently have in the case structure of the producer loop?
03-14-2013 08:56 AM
vt92 Thank you also for your input i will check out your link now.