Not enough input arguments.
이전 댓글 표시
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
Walter Roberson
2020년 10월 24일
How are you invoking the function?
danielle sisserman
2020년 10월 24일
KSSV
2020년 10월 24일
Don't press the run button. Go to the folder where function is present....define the input variables and then call the function.
k = yourvalue ;
d = yourvalue ;
m = yourvalue ;
Xtrain = your data ;
Ytrain = your data ;
classifier = learnknn(k, d, m, Xtrain, Ytrain) ;
But what is the use of the function?
danielle sisserman
2020년 10월 26일
Walter Roberson
2020년 10월 26일
function varargin = learnknn(varargin)
is code that implements returning a cell containing the input arguments.
danielle sisserman
2020년 11월 5일
Stephen23
2020년 11월 5일
"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:
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Classification Ensembles에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!