How can I read local ecg file using wfdb app?

64 visualizaciones (últimos 30 días)
Kevin T
Kevin T el 30 de Dic. de 2020
Comentada: Star Strider el 5 de Feb. de 2024
I only have a .dat file (no .hea file) which contains all 12 ecg leads.
I download and configure the wfdb app for matlab.
Then I run the following code,
[signal, fs, tm] = rdsamp('ecgfile.dat');
And then I got the error below,
This is my matlab directory, my .dat file is located in F:\Open ECG file data.
Could anyone help me solve this problem?
regards.
  4 comentarios
Julia Liu
Julia Liu el 4 de Ag. de 2022
In my case,
My .dat file is saved under D:\zMATLAB\WFDB\mcode\
The following test1.m is also saved and ran under D:\zMATLAB\WFDB\mcode\
In rdsamp.m, from line 86 - 94,
persistent javaWfdbExec config
if(isempty(javaWfdbExec))
[javaWfdbExec,config]=getWfdbClass('rdsamp');
end
config.WFDB_PATH = 'D:\zMATLAB\WFDB\mcode\'; %%%%%%% added line
%Set default pararamter values
inputs={'recordName','signalList','N','N0','rawUnits','highResolution'};
outputs={'signal','Fs','tm'};
Susan
Susan el 4 de Ag. de 2022
@Julia Liu Thanks for your through explanation. I made sure the .dat file and test1.m are saved under 'C:\User\Desktop\test\mcode\', However, I still get the same error:
any idea?
Error using rdsamp (line 204)
Could not find record: SE8ECG4E. Search path is set to: 'C:\User\Desktop\test\mcode\'

Iniciar sesión para comentar.

Respuestas (2)

Star Strider
Star Strider el 30 de Dic. de 2020
Use the fullfile function to generate the file name with the correct path, then use that result as the argument for ‘rdsamp’.
Then save the three outputs to a ‘.mat’ file so you can load them quickly and conveniently when you need them later.
  7 comentarios
Susan
Susan el 4 de Ag. de 2022
@Star Strider I am getting the same error as Kevin got. As you suggested, I did ''Use the fullfile function to generate the file name with the correct path, then use that result as the argument for ‘rdsamp’." However still getting the same error. it seems the package defaults to searching online for my .dat file instead of searching locally even though I set the path . Any suggestions? thanks in advance!
Star Strider
Star Strider el 5 de Feb. de 2024
See: PhysioBank ATM to get the .mat file versions of the records.

Iniciar sesión para comentar.


Mohammed Abdenacer Merbouti
Mohammed Abdenacer Merbouti el 5 de Feb. de 2024
Editada: Mohammed Abdenacer Merbouti el 5 de Feb. de 2024
There should be at least the following three issues taken care of:
  1. The ".dat" file should always have its ".hea" file with it. The header (.hea) file contains plain text and can be easily deduced from the other ".hea" files of similar records.
  2. You should not pass the full path of the record file to the function "rdsamp".
  • For example, let's say your matlab and record files have the following paths:
  • F:\Open ECG file data\reader.m
  • F:\Open ECG file data\records\rec001.dat
  • F:\Open ECG file data\records\rec001.hea
  • Then you should call "rdsamp" in the reader.m file as follows:
  • [signal, fs, tm] = rdsamp('\records\rec001');
3. The full path of the records should not exceed 256 characters.

Community Treasure Hunt

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

Start Hunting!

Translated by