如果你输入edit ginput并滚动到238-ish行,你会看到
% Adding this to enable automatic updating of currentpoint on the figure
set(fig,'WindowButtonMotionFcn',@(o,e) dummy());
换句话说,ginput在图中设置了一个WindowButtonMotionFcn.我的猜测是impixelinfo也使用这个函数,因此一旦调用ginput就会被禁用.
实际上,在impixelinfoval(impixelinfo使用的函数)中,我们在第83行附近找到:
callbackID = iptaddcallback(hFig,'WindowButtonMotionFcn', @displayPixelInfo);
奇怪的是:点击4分后如何重置?
这种魔力是通过输入线222-ish完成的:
initialState.uisuspendState = uisuspend(fig);
显然,uisuspend是一个未记录的函数,用于暂停任何预先存在的WindowButton *函数,以便稍后重置它们.所以,如果你注释掉这一行
%initialState.uisuspendState = uisuspend(fig);
并保存金币,并重新做一切,你看到你想要的行为.
你也会看到为什么这些函数首先被暂停 – 由于我不太明白的原因,当启用两个这样的函数时,一切都变得非常慢.