I am trying to figure out how I can pass several optional 'Name','Value' pair parameters to a MATLAB function like this: https://es.mathworks.com/help/stats/fitcknn.html
I mean, my parameters are stored in a struct, but this struct does not always contain the same number of parameters pair. E.g., I can have the following struct:
options.NumNeighbors = 3
options.Standardize = 1;
So, the function calling would be:
output = fitcknn(X,Y,'NumNeighbors',options.NumNeighbors,'Standardize',options.Standardize);
But, another time I could have:
options.NumNeighbors = 3
options.Standardize = 1;
options.ScoreTransform = 'logit';
And thus, the function calling will have another parameter pair:
output = fitcknn(X,Y,'NumNeighbors',options.NumNeighbors,'Standardize',...
options.Standardize,'ScoreTransform',options.ScoreTransform);
What I want is to dynamically call the function without worrying about the final number of pair 'Name'-'Value' parameters. I have tested something like this, but it does not work:
options = {'NumNeighbors',3,'Standardize',1};
output = fitcknn(X,Y,options);
Any ideas?
Thanks in advance