title: how to find accuracy using multiple value of k in knn classifier (matlab)
body: <p>I use knn classifier to classify images according to their writers (problem of writer recognition). I worked on a given database that contains 150 images with 100 images for training and 50 images for testing. 
  I use this code to find the accuracy of the classifier( k=1):</p>
  
  <pre><code>load('testdirection.mat') 
  load('traindirection.mat')
  load('testlabels.mat') 
  load('trainlabels.mat') 
  class = knnclassify(testdirection,traindirection, trainlabels);
  cp = classperf(testlabels,class);
  cp.CorrectRate 
  fprintf('KNN Classifier Accuracy: %.2f%%\n',100*cp.CorrectRate )
  </code></pre>
  
  <p>I want to find different accuracy for different value for k [1..25] and save result in matrix matlab. I want also to plot the result to see the  variability of accuracy depending on the value of k.
   Please, help me to change this code and thanks in advance</p>