hit.IntersectionPoint在Matlab的ButtonDownFcn中返回NaN

时间:2019-03-14 04:49:13

标签: matlab-app-designer

我已经使用Matlab的AppDesigner开发了一个GUI。要获得鼠标点击,我为绘制的图像设置了ButtonDownFcn回调。然后在回调中读取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]

在我的计算机上,一切正常,但是在同事的计算机上,它返回NaN。据我们所知,差异是:

Mine (works)       Colleague (NaN)
Win10               MacOS
USB Mouse           Laptop Trackpad

有人知道其中一个是否可能成为IntersectionPoint返回NaN的因素吗?还是有其他建议我们可以解决问题?

我已经读过hereIntersectionPoint仅从2018a开始可用。我的同事使用2017b,但是当我在计算机上使用2017b进行测试时,IntersectionPoint仍然有效。

0 个答案:

没有答案