before running your code. Then, execute your code, and it will halt when it encounters the error, and enter debug mode. You can then investigate your variables, to see what's going on.
In your case, given the error message, I am guessing that either n or size(Test,1) is much larger than you expect. You should be able to trace back from there.
You use the more modern fitcknn, which is good, but you then pass the resulting model to the older knnclassify as if the model is training data. To classify your test data these days you should be usingpredict() on the model returned by fitcknn.
Best Answer