changed meshgrid and sub2ind s.t. translation works now.