How to call back a function in a gui

조회 수: 9 (최근 30일)
aheesh gaur
aheesh gaur 2011년 9월 7일
i have made a gui using GUIDE function. I need to call a function when calculate button is pressed in it. Also i need to store the string input in it
  댓글 수: 2
aheesh gaur
aheesh gaur 2011년 9월 7일
when right clicked on the button, i selected create FCn.
Inspector: uicontrol(edit" ") was opened.
now what??
aheesh gaur
aheesh gaur 2011년 9월 7일
i m getting following errors
??? Undefined function or method 'untitled1' for input arguments of type
'char'.
Error in ==>
@(hObject,eventdata)untitled1('how_CreateFcn',hObject,eventdata,guidata(hObject))
??? Error using ==> struct2handle
Error while evaluating axes CreateFcn
??? Undefined function or method 'untitled1' for input arguments of type
'char'.
Error in ==>
@(hObject,eventdata)untitled1('listbox1_CreateFcn',hObject,eventdata,guidata(hObject))
??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn
??? Undefined function or method 'untitled1' for input arguments of type
'char'.
Error in ==>
@(hObject,eventdata)untitled1('edit1_CreateFcn',hObject,eventdata,guidata(hObject))
??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn

댓글을 달려면 로그인하십시오.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2011년 9월 7일
In the GUIDE, right click your 'calculate button', select 'View Callbacks', select 'Callback', that is where you write your function.
When it's done, run your GUI application, when you click the button, that function will be called.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by