unrecognized function or variable 'helperspe​echSpectro​grams'

1 view (last 30 days)
I am using the helperspeechSpectrogram function in a Speech Emotion Recognition progam, and I have the toolboxes installed required for this function.
I am using another function, helperReadSPData, from the same toolboxes which works without errors. if anyone could help me out with what is going wrong here, it would be a big help.
segmentDuration=60000*(1/16000);
frameDuration=0.046;
hopDuration=0.023;
numBands=128;
epsil=1e-6;
scadts_Train=transform(adsTrain,@(x)helperReadSPData(x))
XTrain=helperspeechSpectrograms(scadts_Train,segmentDuration,frameDuration,hopDuration,numBands);
scadts_Test=transform(adsTest,@(x)helperReadSPData(x));
XTest=helperspeechSpectrograms(scadts_Test,segmentDuration,frameDuration,hopDuration,numBands);
  5 Comments
Rimsha Muzaffar
Rimsha Muzaffar on 13 Jul 2022
should we take another class to define this function or define them in same
this one na
function x = helperReadSPData(x)
% This function is only for use Wavelet Toolbox examples. It may change or
% be removed in a future release.
N = numel(x);
if N > 8192
x = x(1:8192);
elseif N < 8192
pad = 8192-N;
prepad = floor(pad/2);
postpad = ceil(pad/2);
x = [zeros(prepad,1) ; x ; zeros(postpad,1)];
end
x = x./max(abs(x));
end
I am actually confused where to write this
Adam Danz
Adam Danz on 13 Jul 2022
MATLAB has to know that helperReadSPData exists. One way to do that is to put the function in an m-file and store the m-file on your matlab path (perhaps in the same folder you are working in). Another way to do that is to define the function at the end of the m-file you're working in. For more info, see Create Function in Files from the documentation.

Sign in to comment.

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!