Let c be 2D array, and x and y be 1D arrays of the same length (for instance, let\'s have x=1:7 and y=3:9).<
c
x
y
x=1:7
y=3:9
You are looking for sub2ind function
res = c( sub2ind(size(c), x, y ) )