2 つのaxes.handles を接続して、一方のマウス ボタンをクリックすると、もう一方も最初のボタンと同じように動作するようにしたいと考えています。マウスがクリックされたときにやりたいことを実行する外部関数があります。1 つの軸がクリックされたときに同じことを行うように、GUI で 2 つのハンドルを更新する必要があるだけです。
メイン 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','');
どんな助けにも感謝します。私は質問を伝えようとするのが苦手です。誰かが助けてくれることを願っています。ありがとう。