Filter löschen
Filter löschen

converting txt file to mat file; ads1298ecgafe-pdk

43 Ansichten (letzte 30 Tage)
Elzbieta
Elzbieta am 19 Sep. 2024 um 9:29
Kommentiert: Elzbieta am 19 Sep. 2024 um 11:30
Hello,
I used ADS1298ECGFE-PDK to capture data from both volonteer patients and multiparameter simulator. As far as I noticed in the data file there are 8 channels recording ECG signal.
In the case of volontueer patients I used 7-input 15-output signal. In the case of multiparameter simulator I used 10-input 15-output cable.
I am trying to convert this 8 channels data to matlab file. How to assign the appropriate channels to specific leads. How to convert to to mat format.
I include the data sample:
Record #: 3
Notes :
normal sinus rhythm
100 BPM
2024-08-2115:26:53Record #: 3
Notes :
normal sinus rhythm
100 BPM
2024-08-2115:26:53
Volts Data
CH1 CH2 CH3 CH4 CH5 CH6 CH7 CH8
-109,386444E-6 567,817688E-6 56,791306E-6 141,954422E-6 330,257416E-6 -61,225891E-6 375,652313E-6 -273,323059E-6
-97,560883E-6 574,731827E-6 62,847137E-6 146,675110E-6 333,023071E-6 -57,744980E-6 380,516052E-6 -268,077850E-6
-116,157532E-6 572,299957E-6 62,561035E-6 116,968155E-6 300,979614E-6 -89,931488E-6 353,384018E-6 -298,929214E-6
-142,574310E-6 572,919846E-6 54,168701E-6 96,273422E-6 285,196304E-6 -107,336044E-6 341,033936E-6 -318,717957E-6
-127,124786E-6 578,546524E-6 55,503845E-6 120,735168E-6 311,803818E-6 -80,060959E-6 364,971161E-6 -292,682648E-6
-114,154816E-6 572,109222E-6 56,123734E-6 135,135651E-6 324,773788E-6 -66,089630E-6 376,653671E-6 -279,045105E-6
-127,410889E-6 563,287735E-6 48,828125E-6 130,081177E-6 322,818756E-6 -69,427490E-6 373,888016E-6 -282,526016E-6
-108,814240E-6 569,248199E-6 50,163269E-6 161,123276E-6 355,148315E-6 -36,144257E-6 400,066376E-6 -249,576569E-6
-88,214874E-6 574,398041E-6 57,458878E-6 174,427032E-6 364,828110E-6 -26,702881E-6 405,120850E-6 -238,609314E-6
-104,761124E-6 574,636459E-6 60,033798E-6 150,871277E-6 339,221954E-6 -51,879883E-6 381,135941E-6 -264,930725E-6
-108,623505E-6 580,310822E-6 65,088272E-6 145,101547E-6 336,027145E-6 -55,980682E-6 379,94

Antworten (1)

Umeshraja
Umeshraja am 19 Sep. 2024 um 11:03
I understand that you're working with ECG data from the ADS1298ECGFE-PDK device and trying to convert it to MATLAB format while assigning the appropriate channels to specific ECG leads.
I assume that the data samples are provided in form of text file (.TXT format). Another assumption is that mapping for the ECG leads to the channels in your setup. The ‘save’ function can be used to save variable from workspace to file
The MATLAB script below script organizes the data into a structured format (ecgData) with fields for each ECG lead.
% Read the data from the text file as strings
opts = delimitedTextImportOptions('NumVariables', 8, 'Delimiter',' ', 'DataLines', 12);
rawData = readmatrix('RawData.txt', opts);
% Function to convert the string format to two numbers
function [num1, num2] = convertToNumbers(str)
parts = strsplit(str, ',');
num1 = str2double(parts{1});
num2 = str2double(parts{2});
end
% Convert the cell array to a numeric array
voltageData = zeros(size(rawData, 1), size(rawData, 2) * 2);
for i = 1:size(rawData, 1)
for j = 1:size(rawData, 2)
[num1, num2] = convertToNumbers(rawData{i,j});
voltageData(i, j*2-1) = num1;
voltageData(i, j*2) = num2;
end
end
% Create a structure to hold the ECG data
ecgData = struct();
% Assign channels to leads based on our assumed mapping
ecgData.leadI = voltageData(:, 1:2);
ecgData.leadII = voltageData(:, 3:4);
ecgData.leadIII = voltageData(:, 5:6);
ecgData.leadAVR = voltageData(:, 7:8);
ecgData.leadAVL = voltageData(:, 9:10);
ecgData.leadAVF = voltageData(:, 11:12);
ecgData.leadV1 = voltageData(:, 13:14);
ecgData.leadV2 = voltageData(:, 15:16);
% Save the data as a .mat file
save('ecg_data.mat', 'ecgData');
To know more on the ‘save’ function, please refer to the following documentation:
  1 Kommentar
Elzbieta
Elzbieta am 19 Sep. 2024 um 11:30
Thank you a lot. Let me present you channels to leads assignment:

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu ECG / EKG finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by