我有一个图形窗口(在函数文件中制作),在这个窗口上,我通过ginput命令获取用户输入。我想要获得鼠标移动的所有坐标,并使用这些坐标来更改图形窗口上的一些颜色。例如。如果我的鼠标在屏幕上移动,我会发出命令
if xCord > 80 && xCord < 100 && yCord> 40 && yCord < 80
set(handle,'facecolor','g')
end如何获得鼠标移动或悬停的所有点?
发布于 2014-12-12 13:41:51
基本的镶嵌和鼠标定位功能如下:
figure()
set (gcf, 'WindowButtonMotionFcn', @mouseover);
function [data] = mouseover(gcbo,eventdata,handles)
c = get (gca, 'CurrentPoint'); % get mouse coordinates
c https://stackoverflow.com/questions/27437368
复制相似问题