Not enough input arguments.
2 views (last 30 days)
Show older comments
Hi, I am very new to matlab and need some basic help.
function classifier = learnknn(k, d, m, Xtrain, Ytrain)
classifier = {k, d, m, Xtrain, Ytrain};
end
I get the error " Not enough input arguments. "
But, I cannot change the first line of this code. Only the body of the function can be modified.
Thank you.
7 Comments
Stephen23
on 5 Nov 2020
"so if I understand, function classifier = learnknn(k, d, m, Xtrain, Ytrain) is actually all I need?"
No, the syntax that Walter Roberson showed replaces your entire function. It uses the special varargin variable:
"and what if I wanted the classifier function to return a diferent datastructure than a cell? for example, if I wanted to return a list object containing the input objects."
MATLAB does not have a "list" type:
Answers (0)
See Also
Categories
Find more on Statistics and Machine Learning 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!