ROI listener in appdesigner not working
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!