title: matlab: making script to analyze data from excel file
body: <p>I am analyzing data from a behavioral experiment. I am reading my data from <strong>one</strong> excel file into matlab.</p>
  
  <pre><code>% load data
  [num,text,raw] = xlsread('stop');
  data=num(:,10); % column 10 in original excel file
  </code></pre>
  
  <p>The variable called <code>data</code> is a one-column vector (25000x1) containing results from all subjects.</p>
  
  <pre><code>data(1:227) is from subject 1. 
  data(228:420) is from subject 2, and so on. 
  </code></pre>
  
  <p>See a part of my data below:</p>
  
  <pre><code>Subject ID    Data
  10011         384
  10011         290
  10011         508
  10033         322
  10033         361
  10033         522
  </code></pre>
  
  <p>I need to get an output that is called <code>"data"</code>. These variables (<code>"data"</code>) should contain all data for each subject. </p>
  
  <p>As of now I've created one variable per subject manually - which is not practical (100 subjects): </p>
  
  <pre><code>x1=find(num(:,1)==10011);
  px1=data(x1,:); and so on up to 100th subject. 
  </code></pre>
  
  <p>It would be better if this process could be automated as I have tried below: </p>
  
  <pre><code>subjects=[10011; 10033...];
  for i=1:length(subjects)
   data=num((find(num(:,1)==subjects(i))),10);
  end
  </code></pre>
  
  <p>If I exchange <code>data</code> with <code>data(i)</code> I'll get an error message. 
  How can I do it? </p>
  
  <p>Help would be greatly appreciated.  </p>