MATLAB: Undefined function or variable

undefined function or variable

I am getting the following error:
this is the function call:
k_distances,k_indices = findKNN(classifier,Xtest(i:1,:));
and this is the first line of the function definition:
function [k_distances,k_indices] = findKNN(classifier,x_test)
can anybody see what I did wrong here?
Thank you

Best Answer

When you want to return results from a function, if there are more then ONE output, use square brackets.
[k_distances,k_indices] = findKNN(classifier,Xtest(i:1,:));
Just like the function header.