title: What is the difference between cvpartition and crossvalind
body: <pre><code>load fisheriris;
  y = species; %label
  X = meas;
  
  %Create a random partition for a stratified 10-fold cross-validation.
  
  c = cvpartition(y,'KFold',10);
  %  split training/testing sets
  [trainIdx testIdx] = crossvalind('HoldOut', y, 0.6);
  </code></pre>
  
  <p><code>crossvalind</code> is used to perform cross-validation by randomly splitting the entire feature set <code>X</code> into training and testing data by returning the indices. Using the indices, we can create train and test data as <code>X(trainIdx,:)</code> and <code>X(testIdx,:)</code> respectively. <code>cvpartition</code> also splits the data using methods such as stratified and non-stratified but it does not return the indices. I have not seen examples where <code>crossvalind</code> is a stratified or non-stratified technique. </p>
  
  <p>Question: Can <code>crossvalind</code> and <code>cvpartition</code> be used together? </p>
  
  <p>I want to do stratified cross-validation. But I don't understand how to divide the data sets into train and test and get the indices.</p>