Search code examples
matlabcoordinate-transformation

Convert (x,y) coordinates in Matlab


In Matlab I have this matrix:

Grid with dimensions [x,y]

I've reshaped it to a single row matrix

Row with dimensions [1,x*y].

How do i know where to find coordinate Grid(x,y) in matrix Row(1,?), and vice versa? Is there a function for this in Matlab?


Solution

  • The functions sub2ind and ind2sub should be what you are looking for.