When you write an array in LabVIEW to a binary file using the Write to Binary File
node (Programming >> File I/O >> Write to Binary File), the size of each dimension of your array is written to the beginning of the binary file by default. You have three options to work with binary files written in LabVIEW that need to be read outside of LabVIEW:
Set prepend array or string size? to FALSE
The Write to Binary File Function
has the prepend array or string size?
parameter that is TRUE by default. If you set this parameter to FALSE, the binary file will not include data size information at the beginning of the binary file.
Note: This parameter only controls the top-level data size information. Arrays and Strings in hierarchical data types such as clusters will always include the size information. As such, if you are writing hierarchical data types to a binary file, setting this parameter to FALSE will not get rid of all the extra bytes you are seeing.
Identify Location of Extra Bytes and Work With Them
If you decide to keep the prepend array or string size?
parameter TRUE or if you are working with hierarchical data that will always have size information retained to a certain extent, the best way to work with the binary data is to understand where the extra bytes are located
and programmatically or manually handle those extra bytes.
Write Your Data Using a Different Data Structure
If your data contains hierarchical data that makes it such that size data is written to the binary file even after you set the prepend array or string size? parameter to FALSE, you can choose to change how you structure the data you are writing to the binary file. Because binary files really do not have a defined structure, it will be up to you to determine how you want to organize your data to be written out. The most important part when doing this is to make sure the other programs you are using to read in the binary files are also using the same data organization scheme.