title: Selecting elements from an array in MATLAB
body: <p>I know that in MATLAB, in the 1D case, you can select elements with indexing such as <code>a([1 5 3])</code>, to return the 1st, 5th, and 3rd elements of a. I have a 2D array, and would like to select out individual elements according to a set of tuples I have. So I may want to get <code>a(1,3), a(1,4), a(2,5)</code> and so on. Currently the best I have is <code>diag(a(tuples(:,1), tuples(:,2))</code>, but this requires a prohibitive amount of memory for larger a and/or tuples. Do I have to convert these tuples into linear indices, or is there a cleaner way of accomplishing what I want without taking so much memory? </p>