功能:按下鼠标后并拖动鼠标,记录鼠标移动过的像素坐标,放开鼠标时结束。
设置鼠标响应
set(gcf,'WindowButtonDownFcn',@ButtonDownFcn);
set(gcf,'WindowButtonUpFcn',@ButtonUpFcn);
set(gcf,'WindowButtonMotionFcn',@ButtonMotionFcn);
gcf为当前figure的句柄;gca为当前坐标轴的句柄。
设置鼠标响应
set(gcf,'WindowButtonDownFcn',@ButtonDownFcn);
set(gcf,'WindowButtonUpFcn',@ButtonUpFcn);
set(gcf,'WindowButtonMotionFcn',@ButtonMotionFcn);
gcf为当前figure的句柄;gca为当前坐标轴的句柄。