Abdullah Al Mubarok
Abdullah Al Mubarok

Reputation: 91

reset ui value in Matlab GUI before changing to new value

So far, just say that I have a GUI and list of uicontrol in it with 1 push button that start the computation process. In the push button, the callback function look like this :

% --- Executes on button press in mulai.
function mulai_Callback(hObject, eventdata, handles)
% hObject    handle to mulai (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%--give the program "Working" status
set(handles.status,'String','Working');

%--empty some edit text
set(handles.misklasifikasi,'String','');
set(handles.nilaiakurasi,'String','');
set(handles.nilaiwaktu,'String','');

%--Some computation process

%--Giving the result
set(handles.misklasifikasi,'String',misklasifikasi);
set(handles.nilaiakurasi,'String',sprintf('%g%% ',akurasi));
set(handles.nilaiwaktu,'String',sprintf('%g detik ',waktu));

%--give the program ready status 
set(handles.status,'String','Ready');

but when I try it the program like just do the command after the computation process, did I missed something???

Thanks in advance...

Upvotes: 1

Views: 825

Answers (1)

Amro
Amro

Reputation: 124563

Try to put a drawnow just before you start the computation. This will force MATLAB to flush the GUI event queue. You want to also place another call at the end of the callback function.

Upvotes: 1

Related Questions