LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

append data to binary file

Hi,

I would like to append data to a binary file. I usde the suggestion from the labview context help to set the file position to end before writing additional data, but when I read the file, I only see 1000 entries instead of 10,000. Can someone please tell me if I am missing something here.

Thank you,

Tim
0 Kudos
Message 1 of 6
(3,584 Views)
I ran you code and with the exception of one error that caused you to have too much data, the code works as advertised. It gives me a 40k file - which is what I would expect - and when I read it I get 10,000 datapoints out of it...

Attached is your write file as I modifed it, and the read file I used to read the data back.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Download All
Message 2 of 6
(3,578 Views)
Hi mikeporter,

I noticed that you added to my write file vi a false constant on the prepend array or string size. Was that the only change you met.

Thank you for your reply.

-Tim
0 Kudos
Message 3 of 6
(3,575 Views)
Yes it is. Having that input true resulted in 4 extra bytes being added to the beginning of each block. These counts were interpreted by the binary read as additional data values - so actually the code, as originally written, was writing 10010 values to the file.

Looks like the problem is in your read VI.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 6
(3,574 Views)
Hi mikeporter,

Here is my read file vi. I noticed your approach is much more complicated, but the data that comes pack looks odd, since we have negative values as well. When you wire data out of the loop, it should only go from 0 to 1000, and never go negative. I also have attached  a screenshot from my pc of the data that I get back. Please compare this with what you have.

Thank you,

-Tim


Download All
0 Kudos
Message 5 of 6
(3,567 Views)
I had to tweak your read a bit to make it work. The data in the example you sent was derived from the counter of a for loop ans so is by definition positive, however I modified it to go from -500 to +500 and it still works - write and read.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 6
(3,558 Views)