I have a matlab function
function [indx, indy] = coord2index(hres, vres, hdiv, vdiv, x, y)
indx = hdiv + x + 1;
indy = -1*y + vdiv;
How can I convert it to python function.
I can be wrong but have you tried this:
def coord2index(hres, vres, hdiv, vdiv, x, y):
return hdiv + x + 1, (-1) * y + vdiv
You can read more on functions defining in python tutorial