can anyone help to solve this matlab error of not enough input arguments?
2 views (last 30 days)
Show older comments
Pooja Prajapati
on 26 Jan 2017
Commented: Walter Roberson
on 28 Jan 2017
function [ceps,freqresp,fb,fbrecon,freqrecon]=mfcc(input,fs,frate)
global mfccDCTMatrix mfccFilterWeights
[r,c]=size(input); % error occur in this line
if(r > c)
input=input';
end
0 Comments
Accepted Answer
Niels
on 27 Jan 2017
Edited: Niels
on 27 Jan 2017
so...
you changed the order of the input arguments again?... you have to decide yourself wether it shall be
1. case
function [ceps,freqresp,fb,fbrecon,freqrecon]=mfcc(w1,fs,frate)
or 2. case
function [ceps,freqresp,fb,fbrecon,freqrecon]=mfcc(fs,w1,frate)
to call your function type in your command window
1. case
[ceps,freqresp,fb,fbrecon,freqrecon]=mfcc(w1,fs,frate)
ofc you have the set the variables w1, fs and frate to some values... thats what walter did: also in the command window
w1=rand(50, 864);
fs=9600, 57.2);
frate=57.2;
% then call your function like shown above or
2. case
[ceps,freqresp,fb,fbrecon,freqrecon]=mfcc(fs,w1,frate)
in your picture you put a single number as input for w1, i thought you might expect w1 to be a matrix (since you check its size etc), walter generated a random matrix with size 50x864
3 Comments
Niels
on 27 Jan 2017
Edited: Niels
on 27 Jan 2017
The values in my/ walters answer are just random numbers.
You shouldnt use these results getting from our example for anything. You need to Fill the variables with your own data. You might have some. Otherwise why would you try to use this function.
To answer your questions: i propose you do as guillaume said. Learn the basics. That will improve your understanding of how functions work. And i am sry but i cant help you any further because i have no clue of working with audio files.
More Answers (2)
Guillaume
on 26 Jan 2017
Clearly, you've called the function without giving it any input. I.e, you should call the function with:
mfcc(somevariable, someothervariable, somethingelse)
Note that calling the first input input is a very bad idea as it overrides the matlab function with the same name. Give that first input a different name.
Also, I would strongly reconsider having global variables. Whatever time saving it may give you now, you'll likely spend twice as much debugging weird issues later on.
7 Comments
Guillaume
on 27 Jan 2017
Edited: Guillaume
on 27 Jan 2017
As Walter and I told you, you need to call the function with the required number of inputs. The same way that if you call
y = sin()
matlab returns the error not enough input arguments since you need at least one input for sin.
What that input should be, only you knows, the same way only you knows what angle you want the sin of.
If it's a function you wrote, I don't understand how you don't know what the inputs should be. They're whatever you thought was necessary. If it's not a function you wrote then refer to its documentation or ask its author. We can't guess that for you. The only thing that is clear from your code sample is that this badly named input should be a 2D matrix.
It looks to me that you're lacking some very basic understanding of how matlab works. I would recommend you go through the getting started tutorial and learn about functions
Walter Roberson
on 28 Jan 2017
w1 should be the data to be processed.
fs should be the sampling frequency the data was processed for.
frate should be the number of windows that the data will be broken up into. If you do not provide a value then 100 will be used by default.
See Also
Categories
Find more on Audio I/O and Waveform Generation 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!