Preprocessing PTB-XL dataset in MATLAB

조회 수: 6 (최근 30일)
Ralph
Ralph 2024년 7월 13일
댓글: Umar 2024년 7월 15일
Hello! How can I open specific records from PTB-XL dataset and process them in MATLAB? What I want to do is to first load the ECG leads loaded in .dat file one by one so that I can preprocess them, such as applying digital filters, prior to the creation of composite lead (mixture of 12-lead ECG in one waveform). I have WFDB tool from Physionet. However, it is not working on the dataset. I have the dataset downloaded in my laptop. Thank you!
  댓글 수: 3
Walter Roberson
Walter Roberson 2024년 7월 13일
I have WFDB tool from Physionet. However, it is not working on the dataset.
Could we get some more information as to how it is failing?
Ralph
Ralph 2024년 7월 14일
편집: Ralph 2024년 7월 14일
Basically, when I try to follow the documentation in the tool, it keeps throwing an error that the file is nowhere to be found. It turns out that the tool is set to read files available in the PhysioBank ATM. PTB-XL is not available to that site.

댓글을 달려면 로그인하십시오.

채택된 답변

Umar
Umar 2024년 7월 13일
편집: Walter Roberson 2024년 7월 13일
Hi Ralph,
I can certainly help you with that. So, basically your objective is to open specific records from the PTB-XL dataset and process them in MATLAB which involves loading ECG leads from .dat files, preprocessing them by applying digital filters, and creating a composite lead. Since the WFDB tool from Physionet is not working for this dataset, you are looking alternative method to achieve this using MATLAB. You already know load the .dat file and its corresponding .hea file, since the WFDB tool is not working, you can directly read the .dat file using MATLAB's `fread` function, and parse the header information from the .hea file using standard file input/output functions. For more information on this function, please refer to,
Next step involves preprocessing the ECG leads, so once you have loaded the ECG leads, apply digital filters for preprocessing by installing DSP System Toolbox. For more information regarding DSP System Toolbox, please refer to
Finally, create a composite lead by simply combining the preprocessed ECG signals using MATLAB's array manipulation functions like `vertcat` or `horzcat`. For more information on these functions, please refer to
Here's a sample MATLAB script to illustrate the above steps:
% Step 1: Load the .dat file and its corresponding .hea file
fid = fopen('your_ecg_record.dat', 'r'); data = fread(fid, 'int16'); fclose(fid);
headerInfo = importdata('your_ecg_record.hea');
% Step 2: Preprocess the ECG leads
fs = headerInfo.SamplingFrequency; [b, a] = butter(4, [0.5 40]/(fs/2), 'bandpass'); filteredData = filter(b, a, data);
% Step 3: Create a composite lead
compositeLead = [filteredData1, filteredData2, ...]; % Combine all filtered ECG signals
% Additional considerations: You can further analyze and visualize the composite lead using MATLAB's plotting functions such as `plot` or `plotyy`. Additionally, consider saving the preprocessed data using MATLAB's `save` function for future use.
I hope this helps! Let me know if you need further assistance.
  댓글 수: 5
Ralph
Ralph 2024년 7월 15일
Yes, thank you for your help guys!
Umar
Umar 2024년 7월 15일
No problem, glad to know your issues have been resolved. If you still need any further assistance or help, please let us know. Good luck with your future endeavors.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by