1

到目前为止,只要说我有一个 GUI 和 uicontrol 列表,其中有 1 个启动计算过程的按钮。在按钮中,回调函数如下所示:

% --- 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');

但是当我尝试这个程序时,就像在计算过程之后执行命令一样,我错过了什么吗???

提前致谢...

4

1 回答 1

1

尝试drawnow在开始计算之前放置一个。这将强制 MATLAB 刷新 GUI 事件队列。您还想在回调函数的末尾进行另一个调用。

于 2013-05-27T21:53:00.797 回答