How to convert a 1x1 struct to double matrix (error using pan tompkin)?
Show older comments
I'm trying to use Pan Tompkins code to detect QRS from ECG signal, and I'm facing a problem, the code defines ecg as vector, but there's part of the code function that uses this line:
ecg_h = filtfilt(a,b,ecg);
But ecg has to be a double matrix for filtfilt function to work. I tried loading the signal before defining it as ecg because it gets loaded as double matrix, but that didn't work, I kept getting undevined variable error.
% Load data
ecg=load('ECGdata.mat');
fs = 500; % Sampling frequency
t = (0:length(ecg)-1) /fs;
gr=1;
QRS=pan_tompkin(ecg,fs,gr);
3 Comments
Image Analyst
on 1 Jun 2024
Take the semicolon off the load statement and tell us what you see in the command window. Or better yet, attach the mat file.
If you have any more questions, then attach your data with the paperclip icon after you read this:
Student
on 1 Jun 2024
Student
on 2 Jun 2024
Accepted Answer
More Answers (0)
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
