title: How to fix the test and train set in svm using matlab?
body: <p>I am new to matlab. I want to know how to fixed the train and test set in <strong><code>svm</code></strong> code because I had <strong><a href="http://www.egr.msu.edu/classes/ece480/capstone/spring11/group04/application_Kan.pdf" rel="nofollow">find a code</a></strong>, the code randomly selects the test and train set. my database is <strong><code>YMU</code></strong> database, how should I fix the train and test set using <strong><code>svm</code></strong> code. because I use the <code>crossvalind</code> to randomly select the train and test set. which variable should I change with the crossvalind?</p>
  
  <pre><code>%load YMU database
  %NMC is non-makeup , MC is makeup
  %testingset = non-makeup, trainingset is makeup
  load TestingSetNMC.mat
  load TrainingSetMC.mat
  load gnd_Test.mat
  load gnd_Train.mat
  
  data1 = TrainingSet;
  data2 = TestingSet;
  groups1 = ismember(gnd_Train,'data1');
  groups2 = ismember(gnd_Test,'data2');
  %crossvalind is random choose
  [train] = crossvalind('holdOut',groups1);
  [test] = crossvalind('holdOut',groups2);
  cp = classperf(groups1);
  svmStruct = svmtrain(data1(train,:),groups1(train),'showplot',true);
  classes = svmclassify(svmStruct,data2(test,:),'showplot',true);
  classperf(cp,classes,test);
  cp.CorrectRate
  </code></pre>