Using multiple indicies to grab values from 2D MATLAB array without returning all combinations : <p>I am trying to get a few values from a 2D matrix</p>

<p>Consider the starting matrix:</p>

<pre><code>&gt;&gt; test = randi(10,10)

test =

10     4     8     7    10     4     2     8     4     1
 6     5     6     5     5     2    10     4     7     6
 7     2     5     4     1     1     3     7     6     1
 1     3     3     9     9     5    10     4     6     9
 9     1     8     4     7     2     3     7     3    10
 8    10     3     9     4     8     4     1     3     1
 2     7     1     8    10     4     1    10     5    10
 6    10     8     9     3     9     7     9     3     1
 4     2     7     6     7     8     2     8     9     7
 6    10     8     7     7     6     1     9    10     8
</code></pre>

<p>What I want to do is grab elements (1,4);(2,5);and(3,6) only</p>

<p>So I try </p>

<pre><code>test([1,2,3],[4,5,6])
</code></pre>

<p>but that returns all combinations of the two indicies!</p>

<pre><code>ans =

 6     3     1
 1     2     4
 8     4     8
</code></pre>

<p>Without this intermediate step, how do I do what I want in one line?  There must be a way.</p>

<p>I cannot use the intermediate step because in actuality, my matrix is very large and so are my indices lengths so I will run out of memory.</p>
