How to switch show between 2 static text in matlab GUI

조회 수: 1 (최근 30일)
Adisorn Phanukthong
Adisorn Phanukthong 2017년 6월 9일
댓글: Jan 2017년 6월 19일
hide A and show N ,hide N and show A
  댓글 수: 3
Adisorn Phanukthong
Adisorn Phanukthong 2017년 6월 13일
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
Adisorn Phanukthong 2017년 6월 13일
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에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by