Replace a subplot title on a figure from another function in appdesigner
Mostra commenti meno recenti
Hello, In appdesigner I have created an image on a subplot in a figure:
f1=figure('position',pos);
s1=subplot(1,3,1)
Im using a roi.ellipse object with an event listener, to allow the user to move and resize the ellipse.(all works fine)
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',@app.allevents);
what I want to do, is in the function "allevents" where I obtain the moved ellipse parameters, is to calculate the area and then replace the title of the sublot s1 with the area. But I'm having issues with changing the title.
function allevents(app,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)]);
a=evt.CurrentSemiAxes(1)
b=evt.CurrentSemiAxes(2)
area=pi*app.a*app.b
title(s1,['Area=',num2str(area,'%.1f')])
end
end
1 Commento
Jason
il 17 Giu 2020
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Subplots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!