A supper simple GUI with only one push button doesn't work weirdly

I created a very simple GUI on MATLAB version R2015a. That program just only contains a push button like below figure:
When the button is hit, the callback "disp('Hello World')" will be executed. But when I run the GUI, nothing happens. Could some one help me? Below is the callback:
% --- Executes on button press in pushbutton1.
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)
%surf(membrane(1))
disp('Hello World')
%guidata(hObject, handles);

 채택된 답변

Set a breakpoint on the disp line to see if it gets there.
Are you sure you looked in the command window?
Instead of disp(), try this:
uiwait(helpdlg('Hello Chuong!'));
to put it in a popup message box instead of the command window.

추가 답변 (1개)

Chuong Le
Chuong Le 2017년 3월 28일
편집: Chuong Le 2017년 7월 21일

0 개 추천

Dear Image Analyst,
I apply setting breakpoints to debug; but the GUI doesn't work. The callback might do nothing (disp line is not reached maybe).
I finally find the cause may come from insufficient software installation. Reinstalling to MATLAB version R2015b with full license settings solved this weird issue. Thank you.

카테고리

도움말 센터 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

질문:

2017년 3월 28일

편집:

2017년 7월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by