Adding features based on retreiving lost information

1 vue (au cours des 30 derniers jours)
Elzbieta
Elzbieta le 7 Août 2024
Hello,
I am processing sample ECG recording (with sampling frequency 256) including information about patient name, patient position and recording device. I join the single files based on string related to patient name. Further I manually mark artefacts for each joined file related to the patient (the information about position and device is included in separate columns with an integer number) in txt files in the following form for instance:
+234.0000000,+244.0000000
+254.0000000,+277.0000000
+284.0000000,+293.0000000
+344.0000000,+352.0000000
Finally I need to assign the proper artefacts to each separate output file containing features related to the patient name, patient position and recording device. Could I ask how to retrieve and assign information about artefacts and assign them to right files?
Elzbieta
  1 commentaire
Matlab Pro
Matlab Pro le 7 Août 2024
Well, please supply some files examples so it will be easy to help you.
(I believe you need to chagne some personal detailes (names/ID) for privacy issues)

Connectez-vous pour commenter.

Réponses (1)

Shantanu Dixit
Shantanu Dixit le 20 Août 2024
Hi Elzbieta,
Assuming that you have multiple ECG recordings with each file containing information about patient including their name, position and device and the corresponding artifact for each data, retrieving and assigning information about artifacts can be obtained by iterating over the files and appending the artifact data to the main 'ECG data' (assuming the file is a struct or table).
Refer to the below high-level code for an overview
% Get list of ECG files
ecg_files = dir(fullfile(ecg_dir, '*_ecg.mat'));
% iterate over the files
for i = 1:length(ecg_files)
% Load ECG data
ecg_data = load(fullfile(ecg_dir, ecg_files(i).name));
patient_name = ecg_data.patient_name;
% for each file
% assuming the artifact file starts by the patient name
artifact_filename = fullfile(artifact_dir, [patient_name '_artifacts.txt']);
if exist(artifact_filename, 'file')
% Read artifact data
artifact_data = dlmread(artifact_filename, ',');
else
fprintf('No artifact file found for patient: %s\n', patient_name);
end
% assign artifact Data to ECG data
ecg_data.artifacts = artifact_data;
Additionally refer to the below MathWorks documentation for above used functions

Catégories

En savoir plus sur Signal Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by