在callback里调用即可,例如按钮button1按下出现警告对话框
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
msgbox('这是一个警告消息框','警告','warn');
用户不按确定是不会自动关闭的。