Change message in static text in a gui -loop
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi guys,
I am having some trouble changing a static text in a gui. I have a loop and a message that changes along that loop.
I want the message in the static text to change with it.
I have tried using set() but it isn't working...
For example:
If x=2
d='True';
else
d='False';
end
set(handles.statictext,'String',d);
Can anyone help?
Thanks in advance!
Inês
댓글 수: 0
채택된 답변
Image Analyst
2015년 7월 7일
Use double equals and not equals. Also use if not If, and use drawnow. Try it like this:
if x==2 % Use == not =
d='True';
else
d='False';
end
set(handles.statictext,'String',d);
drawnow; % Force immediate update.
댓글 수: 2
Image Analyst
2015년 7월 8일
You probably did not give the "tag" property of your static text label. Put
handles
right before the set() call, and see what values it lists for handles. Your static text label should be one of the names listed.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!