title: in matlab, calculate mean in a part of one column where another column satisfies a condition
body: <p>I'm quite new to matlab, and I'm curious how to do this:</p>
  
  <p>I have a rather large (27000x11) matrix, and the 8th column contains a number which changes sometimes but is constant for like 2000 rows (not necessarily consecutive). </p>
  
  <p>I would like to calculate the mean of the entries in the 3rd column for those rows where the 8th column has the same value. This for each value of the 8th column.
  I would also like to plot the 3rd column's means as a function of the 8th column's value but that I can do if I can get a new matrix (2x2) containing [mean_of_3rd,8th].</p>
  
  <p>Ex: (smaller matrix for convenience)<p>
  1 <strong><em>2</em></strong> 3 4 5<br>
  3 7 5 3 2<br>
  1 <strong>3</strong> 2 5 3<br>
  4 <strong>5</strong> 7 5 8<br>
  2 <strong><em>4</em></strong> 7 4 4<br></p>
  
  <p>Since the 4th column has the same value in row 1 and 5 I'd like to calculate the mean of 2 and 4 (the corresponding elements of column 2, italic bold) and put it in another matrix together with the 4th column's value. The same for 3 and 5 (bold) since the 4th column has the same value for these two.</p>
  
  <p>3 4<br>
  4 5</p>
  
  <p>and so on... is this possible in an easy way?</p>