Hi. I have written a windowsButtonDown function (in App Designer) to report back the coordinates of a plot on a UIAxes component.
function figure1WindowButtonDown(app, event)
delete(findobj(app.UIAxes,'type','images.roi.Point'));
z=app.UIAxes.CurrentPoint;
x=z(1,1); y=z(1,2);
if x >= app.UIAxes.XLim(1) & x <= app.UIAxes.XLim(2) & y >= app.UIAxes.YLim(1) & y <= app.UIAxes.YLim(2)
app.xyAX1=[x,y];
drawpoint(app.UIAxes,'Position',[x y]);
end
Whilst this works, I also want to use a button down function on a seperate UIAxes4 which holds a greyscale Image (16 bit). (The idea is read back the value on the image at the location as the useful impixelinfo tool (for GUIDE) doesn't work with appdesigner yet.
So I put another if statement in:
if x >= app.UIAxes4.XLim(1) & x <= app.UIAxes4.XLim(2) & y >= app.UIAxes4.YLim(1) & y <= app.UIAxes4.YLim(2)
delete(findobj(app.UIAxes4,'Marker','+'));
z=app.UIAxes4.CurrentPoint;
x=round(z(1,1)); y=round(z(1,2));
hold(app.UIAxes4,'on');
plot(app.UIAxes4,x,y,'r+')
end
But it doesnt seem to be branching correctly, when I click on UIAxes not only does it draw the point (via drawpoint) on the UIAxes, it also does on the UIAxes4 (and resizes the image weirdly!)