ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing data to binary file byte issue

Solved!
Go to solution

I am attempting to write a 22 channel array to a binary file. Each single-precision number in the array should be 4 bytes, so after writing to the file, I expect it to be 88 bytes in size. However, when writing the whole array to the file, it comes out to 92 bytes. I am not sure where the extra 4 bytes are coming from.

 

When I index the array and write each data point separately, it gives me the result I want (88 bytes). Ideally, I would like to be able to write the whole array rather than each point. Any idea what is going on here? 

0 Kudos
Message 1 of 3
(3,299 Views)
Solution
Accepted by topic author arob

If you're writing an array, then it's probably adding in a header for the array that specifies the size.  Check the first 4 bytes, it probably decodes to 22 and then the rest of the data matches your data exactly.

Message 2 of 3
(3,285 Views)

Yup, i was missing a false on the "prepend array or string size?" input for the write to binary file function 

0 Kudos
Message 3 of 3
(3,275 Views)