How to convert a 1×1 struct to double matrix (error using pan tompkin)?
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);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); 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); pan_tompkin, ecg, qrs, vector, matrix, reshape MATLAB Answers — New Questions