title: how to create leave one out cross validation in matlab?
body: <p>I am still confused with my code. I tried to implement leave one out cross validation in matlab for classification. so in here . I take out one data from training become testing data. I already make a code in matlab. but Iam not sure it's correct because the result is wrong. can someone help me to correct it?? thank you very much.</p>
  
  <p>this is my code :</p>
  
  <pre><code>clc    
  [C,F] = train('D:\fp\',...
      'D:\tp\');
  
  
  for i=size(F,1)
  testVal = i;      
  trainingSet = setdiff(1:numel(C), testVal); % use the rest for training
  
  Ctrain = C(trainingSet,:);
  Ftrain = F(trainingSet,:);
  test= F(testVal,:);
  svmStruct = svmtrain(Ftrain,Ctrain,'showplot',true,'Kernel_Function','rbf');
  result_class(i)= svmclassify(svmStruct,test,'showplot',true);
  ax(i)=result_class;
  i=i+1;
  end
  </code></pre>