MATLAB: UIControl callback error but the code seem correct

error while evaluating uicontrol callbackgui calculatormatlab call back error

I have a error while trying to create GUI calculator. I copy and paste the code directly from internet so the code should be correct. when I press a button on calculator, the following error appear
Reference to non-existent field 'text1'.
Error in ver2cal>One_Callback (line 81)
OLDstring=get(handles.text1,'string');
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in ver2cal (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ver2cal('One_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
This is the code I have use on that button
% --- Executes on button press in One.
function One_Callback(hObject, eventdata, handles)
% hObject handle to One (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
OLDstring=get(handles.text1,'string');
NEWstring=('1');
textstring=strcat(OLDstring, NEWstring);
set(handles.text1,'string',textstring);

Best Answer

That code expects a .fig file that defines a uicontrol with tag text1