LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read write to binary

Does anyone know of a way to open a binary file, so it can it can be read from and written to in sequence?  Right now, the only way I've managed to either read or write, is by openning the file before then closing the file after, for each operation.
 
I'm trying to take a series of readings that needs to be interpolated.  Since the collection of readings should be very large, I decided to do binary I/O files.  In order to interpolate values, while I'm reading, I need to first save the value read, then interpolate the samples between the current value, and the previously read value.  This is why I need read/write accesss without open/closing my binary files multple times in a single loop.
 
If someone knows of a better way to do this, I'd be willing to listen as well.
0 Kudos
Message 1 of 4
(2,362 Views)
Hello,

as I understand it you would merely have to tell the read function the correct offset for the new value to be read. I have done binary I/O a couple of times, with LV 7.0 and LV 8.0.1 - and it works just fine. Definitely it should not be necessary to open and close a binary file each loop iteration...

Hope I got you correctly.

Comrade
0 Kudos
Message 2 of 4
(2,350 Views)
Read the entire file and store the values into an array.  Then you can loop through the array and work with the values as you need.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 4
(2,351 Views)

Great, I think that worked.  I was already using the set file position for appending new data, but not for the read data.  Now it makes sense why I was getting an EOF error when I read.

As for reading the entire file to an array... processing... then writing again, I'm trying to avoid this, because I fear the amount of data I will be processing and interpolating will take up too many system resources (as I collect more and more data).  Thanks for all the help.

0 Kudos
Message 4 of 4
(2,345 Views)