title: MATLAB: X and Y do not have the same number of observations.(error) classregtree()
body: <p>Im trying to use function <code>classregtree</code> for building a tree. classTrain is a cell array with 2 string values. I use <code>grp2idx</code>() function for indexing strings, not using this function causes error <code>"X must be a matrix of floating-point numbers."</code>. Now I have in training_data = 200x1 and in test_data = 1800x1 and i got this error <code>"X and Y do not have the same number of observations."</code> Training and Testing data i generate randomly.</p>
  
  <p>Maybe somebody knows how to solve this problem?    </p>
  
  <pre><code>classTrain = {};
          classTest = {};
          for ind = trainInd  
              classTrain{end+1} = class{ind};
          end
          for ind = testInd
              classTest{end+1} = class{ind};
          end
  
  
          %1) building tree
          training_data = grp2idx(classTrain);
          test_data = grp2idx(classTest);
      &gt;&gt;&gt;&gt; t = classregtree(training_data', test_data',  'method','classification' , 'prune', 'off', 'splitmin', 2);
  </code></pre>