title: how to get values of a matrix in MATLAB where the indices are given in a nx2 array
body: <p>I have a matrix <code>A</code> of size nRows x nCols.</p>
  
  <p>I have a <code>nx2</code> matrix <code>B</code> which contains indices of the matrix <code>A</code>.
  I want to get the values of <code>A</code> at the indices given in <code>B</code>.</p>
  
  <p>lets say,</p>
  
  <pre><code>B = [1, 2;
       2, 3;
       3, 4]
  
  A(1,2) = 1
  A(2,3) = 2
  A(3,4) = 1
  </code></pre>
  
  <p>I want to know any Matlab command which gives the following, given <code>A</code> and <code>B</code> (I don't want to use loops):</p>
  
  <pre><code>[1 2 1] 
  </code></pre>