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!