title: Octave: Access value from a matrix by passing indices in a vector?
body: <p>I need to access/edit values in an <code>n</code> dimensional matrix <code>M</code>, by passing a vector <code>V</code>, containing indices.</p>
  
  <p>let<br>
  <code>M = [ 1,2,3;
         4,5,6;
         7,8,9;];</code> </p>
  
  <p>index vectors be</p>
  
  <p><code>V1=[2,1];
   V2=[1,2];</code></p>
  
  <p>now,  <code>M(V1)</code> should give <code>4</code> <br> 
  and  <code>M(V2)</code> should give <code>2</code>;</p>
  
  <p>problem is <code>n</code> is not fixed and I don't want do looping to access values like <code>M(idx_1,idx_2,...idx_n)</code></p>