LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a multi-dimensional array from a binary file?

Hi, experts!
 
Once again I'm stuck with a basic problem in labview. I've ben trying to make a VI that reads a binary measurement file that consists of a 2D array, i.e. n channels of sampled data. This seems to be easier said than done in LV and I the only example I find treats 1D-arrays exclusively. Take a look at the test file attached to this message. I saved it as a labview 7.1 file.
 
Eternally grateful for all help
 
Einar
0 Kudos
Message 1 of 4
(3,056 Views)
Your write operation results into 1000 consecutive values written on disk without any array length indication. You can't read that data directly into a 2D array because the sizes are unknown to the Read function. You should read the whole file into a 1D array and the reshape the array into a 500 by 2 array. See the pict to figure how the Read/Write operations perform on arrays.

Message Edité par JeanPierre le 03-14-2006 09:00 AM



LabVIEW, C'est LabVIEW

Message 2 of 4
(3,049 Views)

Thank you for a very detailed and extremely helpful answer!

I will study the details closer as soon as I have time. One more question: Is it possible to read large binary files "part-by-part" (in a loop, for example) to avoid memory overload? Since the Read from binary file VI does not accept index as an input it seems likely that I have to read the whole file in one big chunk?

regards,

Einar

0 Kudos
Message 3 of 4
(3,036 Views)
Yes you can use the index input. Using the count input, you can read only the required chunk to process. The file marker is updated automatically after read operation so you can ignore the index input when reading the file sequentially.


LabVIEW, C'est LabVIEW

0 Kudos
Message 4 of 4
(3,030 Views)