【问题标题】:Mouse hover Coordinates in MATLABMATLAB中的鼠标悬停坐标
【发布时间】:2014-12-12 05:25:12
【问题描述】:

我有一个图形窗口(在函数文件中制作),我通过 ginput 命令获取用户输入。我想获取鼠标移过的所有坐标,并使用这些坐标更改我的图形窗口上的一些颜色。 例如。如果我的鼠标在屏幕上移动,我会发出命令

if xCord > 80 && xCord < 100 && yCord> 40 && yCord < 80 
set(handle,'facecolor','g')
end

如何获得鼠标移动或悬停的所有点?

【问题讨论】:

    标签: matlab mouseover


    【解决方案1】:

    基本的鼠标悬停和鼠标定位功能如下:

    figure()
    set (gcf, 'WindowButtonMotionFcn', @mouseover);
    
    function [data] = mouseover(gcbo,eventdata,handles)
        c = get (gca, 'CurrentPoint'); % get mouse coordinates
        c    
    

    【讨论】:

      猜你喜欢
      • 2011-08-04
      • 2018-09-03
      • 1970-01-01
      • 1970-01-01
      • 2014-09-07
      • 2015-04-22
      • 2011-05-26
      • 2017-10-14
      • 1970-01-01
      相关资源
      最近更新 更多