Clear Filters
Clear Filters

Undefined function or method 'minus' for input arguments of type 'struct'

2 views (last 30 days)
I am working on speech recognition.I have saved the coefficients of 4 audio files in a matrix in mat file. Now I want to compare those with a test audio file but I keep getting on this error Undefined function or method 'minus' for input arguments of type 'struct' . Can someone please guide me about how can I subtract the coefficients of tested audio sample from all the coefficients in mat file. code is below.
d=load ('Database.mat')
% line 1 loads the Database
[s1,fs] = wavread('x1.wav'); % Reading new file x1.wav
B = [1 -0.95];
s1 = filter(B,1,s1);%first order filter
[c]=melcepst(s1,fs);
n=corrcoef(c) ;% Finds the correlation coefficients
n=n(:); % writing all values in one column
n=abs(n);
dtw(1,1) = dist(1,1); % dynamic time wraping technique to see similarity between input signal and data base
dtw(d,n) = min (dtw(d-1, n-1), dtw(d-1, n), dtw(d, n-1)) + dist(d,n);

Answers (1)

Image Analyst
Image Analyst on 28 Jun 2016
You can't use min like that, like min(num1,num2,num3). It only takes an array so enclose arguments in brackets: min([num1,num2,num3])
dtw(d,n) = min ([dtw(d-1, n-1), dtw(d-1, n), dtw(d, n-1)]) + dist(d,n);
  2 Comments
aliha wasim
aliha wasim on 28 Jun 2016
Thank you. I have corrected my previous mistake in the code but the problem still remains as it is.
Image Analyst
Image Analyst on 28 Jun 2016
We can run the debugger, if you can't do it, if you upload 'database.mat' and 'x1.wav'. I can't run your code without those two files of yours. You can speed things up if you think of these things in advance.

Sign in to comment.

Categories

Find more on Signal Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!