Adding features based on retreiving lost information

조회 수: 2 (최근 30일)
Elzbieta
Elzbieta 2024년 8월 7일
답변: Shantanu Dixit 2024년 8월 20일
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
Matlab Pro
Matlab Pro 2024년 8월 7일
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)

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

답변 (1개)

Shantanu Dixit
Shantanu Dixit 2024년 8월 20일
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

카테고리

Help CenterFile Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by