Getting elements of a matrix with vectors of coordinates

Viewed 8223

This is a really basic question, but I can't seem to solve it or find an answer for it anywhere : suppose I have two vectors x,y of coordinates and a matrix m.

I would like a vector z such that z[i] = m[x[i],y[i]]for all i.

I tried z=m[x,y], but that creates a memory overflow. The vector and matrix are quite large so looping is pretty much out of the question. Any ideas ?

2 Answers
Related