MATLAB: Problem with sampling resolution while reading binary data with fread

binarydatafreadresolutionsampling

Hi
I have downloaded an ECG data from "physionet.org", aami3a.dat(the link is below). The site says it is recorded with 12-bit resolution (@720Hz). I used the following code to open and plot the waveform:
Fid=fopen('D:\SomeAddress\aami3a.dat','r');
Data=fread(Fid,'*int16');
fclose(Fid);
plot(Data');
The problem is it works!!! and I don't understand why!! while it is recorded with 12-bit precision, I'm reading that with 16-bit precision. How does 'fread' function handles this?! I mean I thought when I use '*int16' precision, the 'fread' function separates my binary data 16-bit-by-16-bit and treats each separation as a 16-bit integer and then converts that into decimal (but seems I was wrong). I also tried '*uint16' , '*bit16' precisions which show the same results. But when I use '*bit12' or '*ubit12' I receive a malformed shape which is definitely wrong. can anyone give me an explanation for this? Thanks in advance.

Best Answer

Data that is recorded at 12 bits is, by convention, stored in the 12 most significant bits of a 16 bit word.