Force matlab gui to update ui control mid-function

I'm working on a gui using GUIDE in MATLAB, and from what I've read it looks like MATLAB updates the UI controls based on a timer every so often. Is there a way to force it to update the UI controls, so I can make it update in the middle of the function? Right now I have a function that does, simplifed, something like

set(handles.lblStatus,'String','Processing...')
%function that takes a long time
set(handles.lblStatus,'String','Done')

Since MATLAB doesn't update the GUI during a Callback function, the user only ever sees 'Done' after a long period of waiting and never sees 'Processing'. I tried adding guidata(hObject, handles) after the first set, hoping it would force the screen to update, but it doesn't.

10
задан Alex Zylman 25 August 2010 в 18:42
поделиться

2 ответа

Попробуйте позвонить DRAWNOW.

set(handles.lblStatus,'String','Processing...')
drawnow
%function that takes a long time
set(handles.lblStatus,'String','Done')
16
ответ дан 3 December 2019 в 21:57
поделиться

Я считаю, что в Matlab есть функция Drawow .

drawow завершает отложенные события рисования

0
ответ дан 3 December 2019 в 21:57
поделиться
Другие вопросы по тегам:

Похожие вопросы: