ButtonDownFcn question - different actions on different axes (using GUIDE)
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi.
I am using a mouse down call back to plot a linescan on an image at the mouse location. This all works fine. My issue is that I only want this to happen if I am over a certain axes on my GUIDE layout (i.e. axes1). If I'm on another axes e.g axes2, then I want the mouse click to do something else.
When I display my image in axes 1 I do this:
axes(handles.axes1)
imageHandle=imshow(img,[low,high]);
set(imageHandle,'ButtonDownFcn',@ImageClickCallback); %assign to the buttondown function
I then have the ButtonDownFcn as:
function ImageClickCallback (objectHandle, eventData)
handles = guidata(objectHandle);
axesHandle=get(objectHandle,'Parent'); %Object handle is the image
coordinates=get(axesHandle,'CurrentPoint');
curX = coordinates(1,1)
curY = coordinates(1,2)
x=round(curX)
y=round(curY)
...then perform line scan
so is it possible to limit this mouseclick action just to the axes 1
axes(handles.axes1);
And how would I go about creating another function that operates on axes 2 when I press the mouse button
Thanks Jason
댓글 수: 4
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!