cannot run the code because unknown about getMemberNames function

조회 수: 1 (최근 30일)
Tu Nguyen
Tu Nguyen 2022년 3월 21일
댓글: Cris LaPierre 2022년 3월 21일
Dear all,
This is the answer of my professor about the ECG detection, but I cant run that code. Anyone know how to fix this, please help me
clc;
close all;
clear all;
load ecg_sbj1
load ecg_sbj2
load ecg_sbj3
load ecg_sbj4
nms = getMemberNames(heartrates);
Unrecognized function or variable 'heartrates'.
for k = 1:heartrates.NumMembers
v = getLabelValues(heartrates,k,["QRSregions" "Rpeaks"]);
hr = diff(cellfun(@(x) x.Location,v));
subplot(2,1,k)
histogram(hr,0.5:0.025:1.5)
legend("hrv = " + std(hr))
ylabel(nms(k))
ylim([0 6])
end
function [labelVals,labelLocs] = findQRS(x,t,parentLabelVal,parentLabelLoc,varargin)
labelVals = cell(2,1);
labelLocs = cell(2,1);
if nargin<5
Fs = 250;
else
Fs = varargin{1};
end
df = 20;
load("trainedQTSegmentationNetwork","net")
for kj = 1:size(x,2)
sig = x(:,kj);
mitFSST = computeFSST(sig,Fs);
netPreds = classify(net,mitFSST,MiniBatchSize==50);
QRS = categorical([netPreds{1} netPreds{2}]',"QRS");
msk = signalMask(QRS,MinLength==df,SampleRate==Fs);
r = roimask(msk);
labelVals{kj} = r.Value;
labelLocs{kj} = r.ROILimits;
end
labelVals = vertcat(labelVals{:});
labelLocs = cell2mat(labelLocs);
end

답변 (1개)

Cris LaPierre
Cris LaPierre 2022년 3월 21일
You need the Signal Processing Toolbox in order to use getMemberNames. If it is included on your license, you can use theAdd-ons Explorer to add it.
However, once added, you will find that you do not have a variable names heartrates.
  댓글 수: 2
Tu Nguyen
Tu Nguyen 2022년 3월 21일
I checked my toolbox and have getMemberNames in the toolbox, as I understand that the hearates is run each ecg signal that load above. But the code syill not run. Please help me run the code
Cris LaPierre
Cris LaPierre 2022년 3월 21일
I cannot create the variable for you. You must have code somewhere that does that already.
Each mat file of yours contains 2 variables - ecg and Fs. By loading them back to back the way you are doing, you will only be able to access the data in ecg_sbj4, as it overwrites all the others.
You may need to go back to your professor for more details.

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

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by