I want to build simple multiply function with GUI, but every time a got an error with it, with pushbottom
2 views (last 30 days)
Show older comments
hassan khattak
on 27 May 2022
Commented: hassan khattak
on 30 May 2022
function product_Callback(hObject, eventdata, handles)
x = str2double(get(handles.Input1, 'string'));
y = str2double(get(handles.Input2, 'string'));
multi = x*y;
set(handles.product, 'string', multi);
the error is ...........
Undefined function 'pushbutton1_Callback' for input arguments of type 'matlab.ui.control.UIControl'.
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in GUIIIIII21 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)GUIIIIII21('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
0 Comments
Accepted Answer
Walter Roberson
on 27 May 2022
rename product_Callback to Pushbutton1_Callback
And next time use the facilities of Guide to rename controls so that it will automatically rename the references hidden inside the fig file.
3 Comments
Walter Roberson
on 27 May 2022
Okay, then at the bottom of the .m file add
function pushbutton1_Callback(varargin)
product_Callback(varagin{:});
end
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!