08-20-2012 05:31 PM
I want to read any all the data in a file line by line. I'll be writing the data to arrays and plotting the data eventually. Once all the data is read in I want to wait a minute and read any new data that has been added to the file. I only expect the file to be updated once per minute with one line of data. The problem I'm dealing with is that once I close the file and then open to read again it starts at the beginning, which I do not want. Is there a way to give write priveledges to another program for the data file without it being closed by labview? This way I hope to have it read each new line without starting at the beginning. Right now i'm using the Read from Text File function which does not have a file location input. Is there a way to use this or do I need to use a different function. I've attached my vi. Thanks in advance for any help.
ssmith
Solved! Go to Solution.
08-20-2012 05:33 PM
Sorry forgot to attach file
ssmith
08-20-2012 06:08 PM
@ssmith490D wrote:
. Is there a way to give write priveledges to another program for the data file without it being closed by labview?
Not that I know of.
What you can do is store the file position after you finish you last read and store it in a shift register. When you reopen the file, use Set File Position to set the file position and begin reading from there.
08-20-2012 10:22 PM
@ssmith490D wrote:
I want to read any all the data in a file line by line. I'll be writing the data to arrays and plotting the data eventually. Once all the data is read in I want to wait a minute and read any new data that has been added to the file. I only expect the file to be updated once per minute with one line of data. The problem I'm dealing with is that once I close the file and then open to read again it starts at the beginning, which I do not want. Is there a way to give write priveledges to another program for the data file without it being closed by labview? This way I hope to have it read each new line without starting at the beginning. Right now i'm using the Read from Text File function which does not have a file location input. Is there a way to use this or do I need to use a different function. I've attached my vi. Thanks in advance for any help.
ssmith
Is your other program also a LabVIEW program? If so, you may be able to hold the reference in an action engine in your program (I pretty much always do file operations in an action engine), open an application reference from program #2 and access the functional global directly. But, from the sound of your post, your other application is not in LabVIEW, in which case Raven's solution is best.
08-21-2012 08:50 AM
Thanks Ravens Fan. I appreciate the help.