title: Ranking vector entries by magnitude in MATLAB using vector operations
body: <p>I'm try to find short, efficient vector operations that efficiently rank entries in a vector by their relative magnitude. For example, if a vector is:</p>
  
  <pre><code>A = [212 314 196];
  </code></pre>
  
  <p>I want a function that returns:</p>
  
  <pre><code>B = [2 3 1];
  </code></pre>
  
  <p>I'm messing around with the sort function, but all of my solutions so far have what I think might be an unnecessary for loop. I'm stumped--does anyone know a more elegant way?</p>