Figure does not appear until script finishes

25 visualizaciones (últimos 30 días)
Darnell Gawdin
Darnell Gawdin el 12 de Abr. de 2020
Comentada: Darnell Gawdin el 13 de Abr. de 2020
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

Respuesta aceptada

Matt J
Matt J el 12 de Abr. de 2020
Editada: Matt J el 12 de Abr. de 2020
Use drawnow() to force the figure to update when needed.

Más respuestas (0)

Categorías

Más información sobre Graphics Object Properties en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by