LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Read from Binary File" and efficiency

Solved!
Go to solution
Solution
Accepted by Ken_Brooks

 


@Ken Brooks wrote:

 

Have you found any way to read in your 1D array of bytes without having to stick this header into the file?  


 

I thought you are reading DBL. To read a binary DBL file without header, you simply wire a scalar DBL constant to the type input (not an array!) and wire the desired number of elements to the count input. This will give you a 1D array of DBL. You can set the file location anywhere using "set file position" first.

 

To read a 1D array of bytes is even more trivial. Simply read it as U8 as above or read it as string.

Message 11 of 14
(898 Views)

Here is a simple example how you would write a 3D binary array to a file in 2D sections and explicitly edit the size header into the first 12 bytes of the file. Later you can read it directly as 3D array since the size information is present.

 

Message 12 of 14
(880 Views)

 

thanks, altenbach. Somehow when I first read this recommendation I failed to understand it. But yesterday I discovered for myself the "count" input of which you spoke. So they really do have a raw binary read, they just kind of hide it under the covers. I think I will use this technique, and I think it will greatly simplify the file format I was about to use.
Thanks,
Ken

To read a binary DBL file without header, you simply wire a scalar DBL constant to the type input (not an array!) and wire the desired number of elements to the count input. This will give you a 1D array of DBL. You can set the file location anywhere using "set file position" first.

 

0 Kudos
Message 13 of 14
(844 Views)

good!

0 Kudos
Message 14 of 14
(587 Views)