Problem loading .dat file in matlab

Dear all,
I am currently doing an ECG QRS feature extraction project. I have a problem loading the .dat file in the sample code. An error saying as below :
??? Error using ==> load
Number of columns on line 1 of ASCII file C:\Users\Heng\Documents\MATLAB\aami3a.dat
must be the same as previous lines.
Line error:
Error in ==> qrs_detect_0403 at 3
x1 =load('aami3a.dat'); % load the ECG signal from the file.
Can someone please help me to identify the problem? Your help is much appreciated. Thank you.
Regards,
Heng

3 Kommentare

Wayne King
Wayne King am 4 Mär. 2012
Please tell us what the first line of your .dat file looks like. Is the entire file just numbers, or is their some header information in this file?
heng guo lian
heng guo lian am 4 Mär. 2012
hi wayne, the .dat file is a nonstationary ECG signal, i got this signal from the pyhsionet ECG database. It is not a file just with number.
RAKESH
RAKESH am 22 Aug. 2013
Hi there , i am also suffering with same problem. I am working on a project which required MIT BIH ECG database which is in dat format. Can any body explain how to open that file in matlab?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Walter Roberson
Walter Roberson am 4 Mär. 2012

0 Stimmen

load() is not suitable for .dat files. load() is only suitable for MATLAB binary .mat files, and for text files created with MATLAB's save -ASCII option.
The file extension .dat is used for any data file format, and can be binary or text based or some mix, and there is absolutely no standard about what a .dat file should look like.
If you describe the format of your .dat file, someone might be able to suggest a routine to read in the data.

1 Kommentar

heng guo lian
heng guo lian am 4 Mär. 2012
hi Walter, thanks for the tip. I actually downloaded the sample code from this site to test out. http://matlabz.blogspot.com/2011/04/contents-cancellation-dc-drift-and.html
From the code, it loads the .dat file and it works.
Regards,
Heng

Melden Sie sich an, um zu kommentieren.

Wayne King
Wayne King am 4 Mär. 2012

0 Stimmen

If you look here
You can find links for MATLAB code for reading physionet files.

3 Kommentare

heng guo lian
heng guo lian am 4 Mär. 2012
Thanks for the link..am looking into it now.. Besides that, is there any alternative way of loading .dat file in matlab other than loading it in binary format like in the link you attached above.
I've tried to convert it to binary signal but have problem with the fread function. How do i set the size of the parameter?
Walter Roberson
Walter Roberson am 4 Mär. 2012
Looking at those pages, it appears the .dat files are usually in a binary format.
There are references on those pages to programs that can convert physionet files to .mat files.
heng guo lian
heng guo lian am 4 Mär. 2012
Thanks Walter, i'm downloading the cygwin software from physionet and will try it..i'll come back if i encounter any problem. Thanks alot.

Melden Sie sich an, um zu kommentieren.

Tags

Gefragt:

am 4 Mär. 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by