Clear Filters
Clear Filters

cannot run the code because unknown about getMemberNames function

2 views (last 30 days)
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
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));
legend("hrv = " + std(hr))
ylim([0 6])
function [labelVals,labelLocs] = findQRS(x,t,parentLabelVal,parentLabelLoc,varargin)
labelVals = cell(2,1);
labelLocs = cell(2,1);
if nargin<5
Fs = 250;
Fs = varargin{1};
df = 20;
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;
labelVals = vertcat(labelVals{:});
labelLocs = cell2mat(labelLocs);

Answers (1)

Cris LaPierre
Cris LaPierre on 21 Mar 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.
Tu Nguyen
Tu Nguyen on 21 Mar 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 on 21 Mar 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.

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!