title: Extract "n" rows for each ID in a matrix
body: <p>I have a matrix which has multiple rows per ID.  I need to extract only say..4 LAST rows per ID.  ID cols consists of 2 Cols:</p>
  <pre><code>mat = [ ...
          2222 1   734771 0.11
          2222 1   734772 0.22
          2222 1   734773 0.33
          2222 1   734774 0.44
          2222 1   734775 0.55
          5555 3   734771 0.11
          5555 1   734772 0.12
          5555 1   734773 0.13
        ] ;
  </code></pre>
  <p>answer --&gt;
  % [ 2222 1 734772 0.22 ; 2222 1 734773 0.33 ; 2222 1 734774 0.44 ; 2222 1 734775 0.55]</p>
  <p>I'll appreciate a vectorized approach.</p>