title: Sorting entire matrix according to one column in matlab
body: <p>I have the matrix as follows</p>
  
  <pre><code>a =
  
   1     3
   2     5
   3     2
   4     8
   5     9
  </code></pre>
  
  <p>I want to sort the second column in the <code>a</code> matrix. I want the corresponding rows of column one to be printed as follows :</p>
  
  <pre><code>a =
  
   3     2
   1     3
   2     5
   4     8
   5     9
  </code></pre>
  
  <p>I tried <code>sort(a)</code>, but it is sorting only the second column of matrix <code>a</code>.</p>