how to clear label area in each if/elseif loop ?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Image Analyst
2022-6-21
Can't you just do
app.UIFigure.Text = '';
2 个评论
Image Analyst
2022-7-3
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
2022-7-3
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!