我想连接我的两个axes.handles,这样当点击一个鼠标按钮时,另一个也会做第一个做的事情。我有一个外部函数,可以在单击鼠标时执行我想要执行的操作。我只需要更新 GUI 中的两个句柄,以便在单击一个轴时它会做同样的事情。
在主 GUI
function testminiproj_OpeningFcn(hObject, ~, handles, varargin)
handles.output = hObject;
handles.done=0;
guidata(hObject, handles);
setappdata(0,'figureHandle',gcf);
setappdata(gcf,'axesHandle1',handles.axes6);
setappdata(gcf,'axesHandle2',handles.axes7);
这是我的外部函数,它通过调用mousemotion回调到主GUI;
function varargout = mousemotion(this,varargin)
%// get the figure handle from the application main data
figureHandle = getappdata(0,'figureHandle');
%// get the axes handle from the figure data
axesHandle1 = getappdata(figureHandle,'axesHandle1');
%// get the axes handle from the figure data
axesHandle2 = getappdata(figureHandle,'axesHandle2');
global rdata;
if nargin<1
set(gcf,'WindowButtonDownFcn','mousemotion(''down'')');
set(gcf,'WindowButtonUpFcn','mousemotion(''up'')');
set(gcf,'WindowButtonMotionFcn','');
感谢任何帮助。我不擅长提出问题。希望有人能帮忙。谢谢。