필터 지우기
필터 지우기

problem in Running GUI need help urgent

조회 수: 2 (최근 30일)
Suraj Gurav
Suraj Gurav 2017년 10월 15일
답변: Image Analyst 2017년 10월 15일
I am creating a simple GUI to add 2 numbers. But unable to run it as it shows following error. Could anyone tell me what is going wrong.
Error using str2num (line 31)
Requires character vector or array input.
Error in trial>pushbutton1_Callback (line 127) a=str2num(get(handles.edit1,'String'))+str2num(get(handles.edit2,'String'));
Error in gui_mainfcn (line 95) feval(varargin{:});
Error in trial (line 42) gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)trial('pushbutton1_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback.

채택된 답변

Image Analyst
Image Analyst 2017년 10월 15일
Try
num1 = str2double(handles.edit1.String)
num2 = str2double(handles.edit2.String)
a = num1 + num2

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by