LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read text file

 
 
Is it possible to read a text file and plot  the data into the chart while other instrument is writing some data into the same text file?
Thank you
 
 
0 Kudos
Message 1 of 5
(3,178 Views)
You should be able to read a file from multiple locations but a file opened for writing should have only one writer.  When concurrently accessing data it is possible to have multiple readers and one writer but not multiple simultaneous writers.  How is the instrument connected, is this also through labview?  You might be able to just write to the plot and file without ever reading from the file in that case. The file access is also probably OS dependent, you can often open multiple copies of a file as read only but only open one file with read/write access at a time.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 5
(3,160 Views)
no,the instrument is not connected through labview but through another program. I write the result data into the text file using that another program from the instrument and read the results (and plot into a chart) using labview on the same time. How can I achieve this?
Thank you
 
0 Kudos
Message 3 of 5
(3,142 Views)
You should be able to open the file in "read only" mode and use it while the same file being updated by another program.
 
 
Message 4 of 5
(3,135 Views)
When you use the Open File function, you can specify read only as the open mode. If you can do that when the other program is doing a write, then you have to deal with knowing when the other program has finished doing it's write. If you don't have any direct way to communicate with the other program, knowing that is probably going to be a little tricky. Maybe you can read the number of lines in the file to determine whether the file is complete. If the other program opens the file exclusively, then you won't be able to open it until the other program is complete. You'll get an error back from the Open File function and you can keep trying until the error goes away and then do the read.
 
Of course, the most effecient way would be for you to communicate directly with the instrument using LabVIEW and not use an external program. What kind of instrument is it? How is it connected to the computer (serial, GPIB, etc.)? Have you tried to find a LabVIEW driver for it?
Message 5 of 5
(3,129 Views)