Question
We are implementing it as described in [Waveform Segmentation Using Deep Learning]. https://www.mathworks.com/help/signal/ug/waveform-segmentation-using-deep-learning.html I get an error in the following process and cannot proceed. type getmask.m trainDs = transform(trainDs, @getmask); testDs = transform(testDs, @getmask); The error statement is as follows Error: nargin The function getmask does not exist. Error: matlab.io.datastore.(148) tFuncArgs = nargin(fun); Error:matlab.io.datastore.internal.buildTransformedDatastore(line 65) tds = matlab.io.datastore.TransformedDatastore(datastores, fcn, ... Error: matlab.io.Datastore/transform (line 359) dsnew = matlab.io.datastore.internal.buildTransformedDatastore(varargin{:}); Error: segmentation_default (line 30) trainDs = transform(trainDs, @getmask);
Expert Answer
Prashant Kumar
PhD Expert
Answered Aug 29, 2026
You need to create it from the code they gave you on the page:
function outputCell = getmask(inputCell)
%GETMASK Convert region labels to a mask of labels of size equal to the
%size of the input ECG signal.
%
% inputCell is a two-element cell array containing an ECG signal vector
% and a table of region labels.
%
% outputCell is a two-element cell array containing the ECG signal vector
% and a categorical label vector mask of the same length as the signal.
% Copyright 2020 The MathWorks, Inc.
sig = inputCell{1};
roiTable = inputCell{2};
L = length(sig);
M = signalMask(roiTable);
% Get categorical mask and give priority to QRS regions when there is overlap
mask = catmask(M,L,'OverlapAction','prioritizeByList','PriorityList',[2 1 3]);
% Set missing values to "n/a"
mask(ismissing(mask)) = "n/a";
outputCell = {sig,mask};
end
This example shows how to segment human electrocardiogram (ECG) signals using recurrent deep learning networks and time-frequency analysis.
openExample('deeplearning_shared/WaveformSegmentationUsingDeepLearningExample')
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related deep learning Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →