I have developed a GUI with Matlab's AppDesigner. To pick up mouse clicks, I set the ButtonDownFcn
callback for the image I have plotted. Then inside the callback I read the hit.IntersectionPoint
:
ax = app.UIAxes;
ih = imagesc(I, 'Parent', ax);
ih.ButtonDownFcn = {@im_ButtonDownFcn, app};
_
function im_ButtonDownFcn(im, hit, app)
mouse_pos = flip(round(hit.IntersectionPoint(1:2))); %[NaN NaN NaN]
On my computer everything works, but on a colleague's computer, it returns NaNs. As far as we can tell, the differences are:
Mine (works) Colleague (NaN)
Win10 MacOS
USB Mouse Laptop Trackpad
Does anyone know if either of these could be a factor in IntersectionPoint
returning NaNs? Or have another suggestion that we could troubleshoot?
I have read here that the IntersectionPoint
is only available from 2018a onwards. My colleague uses 2017b, but when I tested on 2017b on my computer, the IntersectionPoint still worked.