필터 지우기
필터 지우기

Figure does not appear until script finishes

조회 수: 39 (최근 30일)
Darnell Gawdin
Darnell Gawdin 2020년 4월 12일
댓글: Darnell Gawdin 2020년 4월 13일
This code is supposed to run an infinite loop unit a key is pressed. The figure does not appear until after the script stops. If I step through the code the figure appears when it should but running the code the figure will not appear or sometimes it will and sometimes it won't. Mostly won't.
%Create figure object
myFig = figure('Name','MyFifgure',"Visible","on")
%Set CurrentCharacter
input = 'x'
set(myFig,'CurrentCharacter',input)
%Loop until key pressed, figure must have focus
while get(myFig,'CurrentCharacter') == 'x'
disp(get(myFig,'CurrentCharacter'))
end
disp(get(myFig,'CurrentCharacter'))
close('all')
Thanks for any help

채택된 답변

Matt J
Matt J 2020년 4월 12일
편집: Matt J 2020년 4월 12일
Use drawnow() to force the figure to update when needed.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by