title: Calculating group mean/medians in MATLAB where group ID is in a separate column
body: <p>I have one column which contains the group ID of each participant. There are three groups so every number in this column is 1, 2 or 3. </p>
  
  <p>Then I have a second column which contains response scores for each participant. I want to calculate the mean/median response score within each group. </p>
  
  <p>I have managed to do this by looping through every row but I sense this is a slow and suboptimal solution. Could someone please suggest a better way of doing things?</p>