LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to store 2C array to a singl binary file

Hi

 

I have to store multiple waveforms output that is each 1D array to a single binary file. how do i do this.

i can store 1D array to binary file and retrieve it by reading the binary file and plotting the waveform. but i am not able to store 2D array to the single file. how do store many 1D array in one binary file,

 

Thank you. Hema

 

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 6
(2,953 Views)

Hi Hema,

 

Are the 1D arrays that you have of different sizes or all with the same size? Depending on this, we could think of ways to accomplish the file saving.

 

A few things to keep in mind when retrieving data from a binary file is the original data type that was wired to the "Write to Binary File.vi"'s data input, and the representation of the data (i.e. I16, U16, etc.) of the data if it was numeric data.

 

Once I have an idea on the details of the 1D arrays, I would be able to help out.

 

Cheers!

 

Sanka Smiley Happy

0 Kudos
Message 2 of 6
(2,939 Views)
There is no difference is saving a 2D array of data to a binary file than storing a 1D array. The key when reading it back is to reshape the 1D array into a 2D array. This is done using the Reshape Aray function. To determine the array dimensions you need to either have written the binary file with the array size prepended to the file (controlled by the prepend array or string size? input of the Write to Binary File function), or use constants if you know what the size is. The attached screenshot shows the latter. See the examples that ship with LabVIEW that show reading/writing binary files for how to do the former.
0 Kudos
Message 3 of 6
(2,930 Views)

(We would also need to know your LabVIEW version. If you have a very old version, things would be quite different.)

 

As Smercurio_fc already mentioned, the option to "prepend array size" would make things much easier here, because then you would read it as a single 2D array.

 

Here's how that would look like. This is probably the recommended solution, just for simplicity reasons.

 

 

Not prepending the size is more useful if you write the data in increments, but later want to read it as one.

Message Edited by altenbach on 11-15-2008 09:02 AM
0 Kudos
Message 4 of 6
(2,923 Views)

Hema.

 

Is your query solved? Do let us know if you have further problems.

 

Gaurav

0 Kudos
Message 5 of 6
(2,901 Views)

Hi ,

Thank you all for helping me out.

I was able to read the 2D data in the correct format. i am using LabVIEW 8.6 and i also used the reshape array function to read data.

Thanks. Hema

0 Kudos
Message 6 of 6
(2,857 Views)