I'm currently trying to implement a reading function for Matlab to evaluate BDF files.
I've used the provided test files (Newtest17-*.bdf) from the website.
The output looks like a sine wave, with high point at approx. -1.1 and low point at approx. -1.55.
This is after I multiplied the values I got from the file with the gain of the channel.
Is this output correct?
My read function looks somewhat like this:
Code: Select all
union __int24 {struct _bytes {byte byte0;
byte byte1;
byte byte2;
byte byte3;
} BYTES;
int value;
};
__int24 buffer;
for (i=0; i < nRecords; i++) {
...forwarding to the channelposition
for (j=0;j<sampleRate;j++)
{
fread(&buffer.BYTES.byte1, 1, 1, file);
fread(&buffer.BYTES.byte2, 1, 1, file);
fread(&buffer.BYTES.byte3, 1, 1, file);
buffer.value<<8;
output[(i*sampleRate)+j] = buffer.value;
}
}