can anyone help to solve this matlab error of not enough input arguments?
Show older comments
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
Accepted Answer
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
Pooja Prajapati
on 27 Jan 2017
Niels
on 27 Jan 2017
Maybe show us how you call your function. You changed the order of the inputarguments. Did you notice??
Walter Roberson
on 27 Jan 2017
The problem is not with that code, the problem is with how you run the code. You cannot run it by just clicking on the run button. You need to go down to the command line and type in mfcc( followed by values for the various arguments, followed by )
mfcc(9600,rand(50, 864), 57.2)
Would be one example
Pooja Prajapati
on 27 Jan 2017
Pooja Prajapati
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.
Pooja Prajapati
on 27 Jan 2017
Edited: Walter Roberson
on 27 Jan 2017
4 Comments
Ill try to express myself in another way.
How do you know that the code does nor work. What did you press or more important what you did type into the command window -> how do you run your code
And do not ignore walters advice. Did you try his example?
And pls use {}code if you post a code
Pooja Prajapati
on 27 Jan 2017
Pooja Prajapati
on 27 Jan 2017
Categories
Find more on String Parsing 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!