How to switch show between 2 static text in matlab GUI

1 次查看(过去 30 天)
hide A and show N ,hide N and show A
  3 个评论
Adisorn Phanukthong
if cellfun(@(x)x == 'A',status)
set(handles.texta,'visible','on');
set(handles.textn,'visible','off');
else
set(handles.textn,'visible','on');
set(handles.texta,'visible','off');
end
right?
Adam
Adam 2017-6-13
I don't know what your exact code is that needs this, but you shouldn't need anything complicated like a cellfun, but you never really stated what the trigger is for changing the visible status.

请先登录,再进行评论。

采纳的回答

Jan
Jan 2017-6-9
Either change the String and Color property of one text object. Or set the 'Visible' property of one to 'on' and the other to 'off'.
  2 个评论
Adisorn Phanukthong
if cellfun(@(x)x == 'A',status)
set(handles.texta,'visible','on');
set(handles.textn,'visible','off');
else
set(handles.textn,'visible','on');
set(handles.texta,'visible','off');
end
right?
Jan
Jan 2017-6-19
Perhaps: if any(strcmp(status, 'A')) is simpler as the cellfun approach. If your code works, it is right. Does it work?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by