LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing binary file when writing a 2D array

Solved!
Go to solution

Yes, we know the exact size of the 2D array and it is always the same. Apparently, the file contains several "chunks", each consisting of two 32 bit numbers and a 2D U8 array. See this post.

 

Quote:


@AlecSt wrote:

The structure is the following: every time the file is called, the program ought to go to the end of the file and write the following things: the 32 bit seconds count, followed by the 32 bit microseconds count, which is lastly followed by a 2D array (which is always the same size.) This forms one chunk. The file is a lot of chunks concatenated together.


 

Thus we need to read the two 32bit numbers and the exact number for the 1D U8 array, then reshape the array as I suggested. Repeat for every chunk. The start offset for each chunk is a simple integer multiple of the chunk size, allowing random access to each chunk.

 

Of course we could also read the entire file as a binary string and chop it up later. 😉

0 Kudos
Message 11 of 12
(731 Views)

Thanks for all the replies. I'll be doing the chopping myself in C code. I was able to read back some files, and you were right about the order of the bits.

0 Kudos
Message 12 of 12
(687 Views)