Preprocessing PTB-XL dataset in MATLAB

16 Ansichten (letzte 30 Tage)
Ralph
Ralph am 13 Jul. 2024
Kommentiert: Umar am 15 Jul. 2024
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 Kommentare
Walter Roberson
Walter Roberson am 13 Jul. 2024
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 am 14 Jul. 2024
Bearbeitet: Ralph am 14 Jul. 2024
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Umar
Umar am 13 Jul. 2024
Bearbeitet: Walter Roberson am 13 Jul. 2024
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 Kommentare
Ralph
Ralph am 15 Jul. 2024
Yes, thank you for your help guys!
Umar
Umar am 15 Jul. 2024
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by