How to call back a function in a gui

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 Kommentare

aheesh gaur
aheesh gaur am 7 Sep. 2011
when right clicked on the button, i selected create FCn.
Inspector: uicontrol(edit" ") was opened.
now what??
aheesh gaur
aheesh gaur am 7 Sep. 2011
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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 7 Sep. 2011

0 Stimmen

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.

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 7 Sep. 2011

Community Treasure Hunt

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

Start Hunting!

Translated by