Given a matrix A, and list of locations within the matrix, where each location is given by \(i,j\) entry, ﬁnd the value in the matrix at these locations
Example, given
A={{1,2,3}, {4,5,6}, {7,8,9}}
obtain the entries at \(1,1\) and \(3,3\) which will be \(1\) and \(9\) in this example.
Matlab A=[1 2 3; 4 5 6; 7 8 9]; I=[1 3]; % setup the I,J indices J=[1 3]; A(sub2ind(size(A),I,J))

ans = 1 9 