how to clear label area in each if/elseif loop ?
1 view (last 30 days)
Show older comments
function UITableCellSelection(app, event)
global t
indices = event.Indices;
n=indices(1);
% Information and the Images of the Missiles
if strcmp(t.System{n},"MIM-23A HAWK")
cla(app.UIAxes)
imshow("MIM_23A_HAWK.jpg","Parent",app.UIAxes)
MsgString = {'Raytheon tarafından geliştirilen sistem'};
WrapString=textwrap(MsgString, 70);
uilabel(app.UIFigure,"Text",WrapString,"Position",[531 17 368 279])
elseif strcmp(t.System{n},"CAMM")
cla(app.UIAxes)
imshow("CAMM.jpg","Parent",app.UIAxes)
MsgString = "Common Anti-air Modular Missile - CAMM ya da deniz ortamında kullanılan Sea Ceptor";
WrapString=textwrap(MsgString, 70);
uilabel(app.UIFigure,"Text",WrapString,"Position",[531 17 368 279])
elseif strcmp(t.System{n},"CAMM-ER")
cla(app.UIAxes)
imshow("CAMM_ER.jpg","Parent",app.UIAxes)
MsgString = "Orta menzilli karatabanlı hava savunma ";
WrapString=textwrap(MsgString, 65);
uilabel(app.UIFigure,"Text",WrapString,"Position",[531 17 368 279])
When I select the CAMM-ER after the CAMM, the texts in the label text area is shown like that. How can I clear the label text area before the second information? Thank you.
0 Comments
Answers (2)
Image Analyst
on 21 Jun 2022
Can't you just do
app.UIFigure.Text = '';
2 Comments
Image Analyst
on 3 Jul 2022
If your static text label is not called UIFigure, then use the actual name of the static text label or edit text field. Let's say the one edit text field near Guidance is called edtGuidance. Then do
app.edtGuidance.Text = 'blah blah blah whatever';
Voss
on 3 Jul 2022
Calling uilabel creates a new label component. Any other label components that already exist are unaffected by the creation of a new label. Therefore, if you want the new label component to replace the old one(s), you would delete the old one(s) when the new one is created.
However, you can avoid having to do all that by using one label the whole time and just update its Text property when needed:
app.Label.Text = WrapString;
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!