[data, labels] = loadDigits(3000, 'train');
[t_data, t_labels] = loadDigits(1000, 'test');
data=data';
labels=labels';
t_data=t_data';
t_labels=t_labels';

k=1;
for j=1:15
    class=knnclassify(t_data, data, labels,j);
    val=0;
    for i=1:1000;
        if class(i,:)~=t_labels(i,:);
        val=val+1;
        end
    end
    error(j)=double((val)/1000*100);
    arr_k(j)=j;
    k=k+1;
end

error;
arr_k;
%z=1:2;
plot(arr_k,error)