Branching a WindowButtonDown function
Mostrar comentarios más antiguos
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)
%Remove any previous drawn "roi point object" that is used to indicate the position clicked on the UIAXes
delete(findobj(app.UIAxes,'type','images.roi.Point'));
z=app.UIAxes.CurrentPoint;
x=z(1,1); y=z(1,2);
%Determine if user clicked on UIAxes
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]; %Save for later use
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:
%See if user selects the Image (UIAxes 4)
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','+')); %Remove any previously drawn '+'
z=app.UIAxes4.CurrentPoint;
x=round(z(1,1)); y=round(z(1,2));
hold(app.UIAxes4,'on');
plot(app.UIAxes4,x,y,'r+') %Visualise positon on image
% TODO....Then will get value from image at this location
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!)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Work with Components en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!