LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Binary Header text

Hello, I am new to reading binary files and have had a lot of help creating this simple read binary vi. There is header information (# of channels, sampling rate etc) on the sample files\ which no matter what I do, I cannot read it. I would really appreciate any help with this!!

Cheers,
Mark
0 Kudos
Message 1 of 11
(3,989 Views)
Hello Mark,

You are connecting the control "Length of heather data" to the offset input of the read file vi.
By doing that you are reading only the values after that byte you connect there.
I think your header are the first 22 bytes of the file, so if you connect 0 to that input, you'll get also those first 22 bytes and then you have to remove them from the array.

Hope this helps,
Paulo
0 Kudos
Message 2 of 11
(3,973 Views)
Hi Mark

I think this is what you're looking to do. See attached.

Hope it helps
Neil
0 Kudos
Message 3 of 11
(3,968 Views)
Let's try that zipped up ...
0 Kudos
Message 4 of 11
(3,967 Views)
Oh dear, it's gotta be Monday. 😉

Once more with the file ...
Message 5 of 11
(3,965 Views)
That is great, I tried this but I am not sure what I did wrong! Thanks so much for everyones help!!
0 Kudos
Message 6 of 11
(3,955 Views)
I actually have another question related to the same vi. Is it possible to automaically calculate the number of samples in a channel. I have varying collected time durations from file to file and just to be safe I always read in a fixed number of samples. This sometimes oversamples and if I change the sample rate, may under sample. I now have reference of the number of channels and sample frequency from the header of each file. Is this possible??

Thanks again for your imput!!
0 Kudos
Message 7 of 11
(3,944 Views)
Hi Gorelick,

By knowing the size of your file in bytes and the way the data is stored, you can calculate how many data points was collected by each channel.

Use the EOF function after opening your file, to get the size of the file through the "offset" output.
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
Message 8 of 11
(3,924 Views)
Thanks that is great!!
Cheers!
0 Kudos
Message 9 of 11
(3,918 Views)
This thread has helped me out tremendously as I am encountering a similar issue.  I am trying to read a binary file that contains very similar data (an EDF file if anyone is familiar) as Gorelick has described, but my files are very large (>150 MB).  How can I modify this vi so that I only read so many data points from my binary file (after pulling the header) then when I perform some action such as a button click I will load up the next set of values.  Originally I was using a MATLAB toolkit to read my file, but it would read the entire file at once an absolutely kill the machine in terms of memory usage, so I need to move away from this.  I really appreciate any help here, this is for a design project, so that I can graduate and I've had to pretty much teach myself LabVIEW from scratch.   If anyone is curious I am using LabVIEW 7.1.
0 Kudos
Message 10 of 11
(3,766 Views)