Search code examples
matlabloadasciidocmatlab-loadecgi

How to read .dat file in MATLAB


I am trying to read an ECG signal from PTB dataset, the file extension is ".dat" ,i am using Matlab function for that:

load('s0484_re.dat');

where "s0484_re.dat" is the file name but i am getting an error like this:

Error using load Unknown text on line number 1 of ASCII file s0484_re.dat "�����\�".

Error in signal2image (line 8) load('s0484_re.dat');

how i can read this file correctly? Any help will be appreciated..


Solution

  • The file extension .dat can be used for many different types of binary data file and doesn't tell you what format the data is in.

    By searching on 'PTB dataset` I found the information that the data files in this dataset are in 'WaveForm DataBase (WFDB) format', and by searching mathworks.com for 'WFDB' I found a few links including a toolbox for handling WFDB files. Try this toolbox, and update your question if it doesn't solve your problem.