LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Binary File

Hello,
I have been trying to read a binary file which is composed of 5 wavefore channels. I have the export information and it says that that the data was stored as two byte integer. I new to using binary files and cannot seem to get a proper array out of the file. I have attached the .dat file, any suggestions would be greatly apprcieated!
0 Kudos
Message 1 of 6
(3,307 Views)
It sure would be nice if you could get your hands on a description of the format of the datafile!

Barring that, trial and error suggests to me that you've actually got six channels of data here, and a 22-byte header with unknown information in it. I say this because if I look at the first N two-byte numbers in the file, I start to see some periodic behavior after the first 22 bytes, and the period is six numbers.

I've attached a VI (LabVIEW 7.1) that shows you my interpretation.

Hope it helps,
John
Message 2 of 6
(3,304 Views)
Thanks for your help, unfortunately I am unable to read your vi since I am using Laview 7.0. COuld you post a jpeg of the vi so that I can try and recreate it? You are right there are 5 columns, I forgot that the first column should be time.

Thanks again for your time,
Mark
0 Kudos
Message 3 of 6
(3,287 Views)
Mark,

Here it is saved for LabVIEW 7.0. It doesn't look like any of the columns are time, but maybe it'll make more sense to you when you have a look.

Take care,
John
0 Kudos
Message 4 of 6
(3,270 Views)
That is fantastic, thank you for your help!! I noticed the swap bytes control, I looked at the help but could not figure out what it does. Also can I use the same process to try and read the header, should provide information regarding the sample frequency, # of samples etc.

Thanks again,
Mark
0 Kudos
Message 5 of 6
(3,247 Views)
Mark,

Check out this Knowledgebase entry on reading/writing binary files with LabVIEW. This explains why I provided the option to swap the bytes of the I16 values in the binary file you had--I figured it would be necessary, and it was.

And yes, the same technique can be used to read in the 22 header bytes and display those 11 numbers, which surely do have relevance that you're interested in.

I'm glad I could help,
John
0 Kudos
Message 6 of 6
(3,233 Views)