ROI listener in appdesigner not working
1 view (last 30 days)
Show older comments
Hello. I am using AppDesigner and have an ellipse drawn onto a UIAxes component using:
subplot(1,3,1); hold on
h = images.roi.Ellipse(gca,'Center',[xpeak xpeak2],'Semiaxes',[1.699*fwhm/2 1.699*fwhm2/2],'Color','g','StripeColor','r','LineWidth',1); %1/e^2 = 1.699xfwhm
%el=addlistener(h,'ROIMoved',@allevents); %This doesn't work, causes an error
el=event.listener(h,'ROIMoved',@allevents)
(The ellipse draws fine and I can move it and resize it)
If I've read the documentation correctly, it suggests using event.listener rather than addlistener.
So in function I have:
function allevents(src,evt)
evname = evt.EventName;
switch(evname)
case{'MovingROI'}
disp(['ROI moving Current Center: ' mat2str(evt.CurrentCenter)]);
disp(['ROI moving Current SemiAxes: ' mat2str(evt.CurrentSemiAxes)]);
case{'ROIMoved'}
disp(['ROI moved Current Center: ' mat2str(evt.CurrentCenter)]);
disp(['ROI moved Current SemiAxes: ' mat2str(evt.CurrentSemiAxes)]);
end
end
Howver, Im not getting anything displayed in the command window.
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!