Filter löschen
Filter löschen

cannot run the code because unknown about getMemberNames function

3 Ansichten (letzte 30 Tage)
Tu Nguyen
Tu Nguyen am 21 Mär. 2022
Kommentiert: Cris LaPierre am 21 Mär. 2022
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

Antworten (1)

Cris LaPierre
Cris LaPierre am 21 Mär. 2022
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 Kommentare
Tu Nguyen
Tu Nguyen am 21 Mär. 2022
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 am 21 Mär. 2022
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.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by