OK - if you look at the documentation of xlsread, it says the function is no longer recommended to be used. Better to use readtable instead.
latih = [latih(:,1) latih(:,2)];
for i = 1 : 80
sampel = y;
test = [sampel(:,1) sampel(:,2)];
nama = "hasil KNN.xlsx";
hasil = [sampel(:,1) sampel(:,2) sampel(:,3) hasil];
As to your other code, I can't comment as I don't have the toolbox on hand with knnclassify. The use of xlswrite (at the end of your code) is also deprecated, so may possibly also produce unpredictable results (as you found with xlsread)