Reference to non-existent field 'text1'.

조회 수: 1 (최근 30일)
Nedomanija
Nedomanija 2020년 5월 29일
Hi guys, I try to create a GUI calculator for my assigment, And i wrote code but i have a couple of errors, i cant solve any of them, please help me, here is my codes and errors ;
function varargout = text1(varargin)
% TEXT1 MATLAB code for text1.fig
% TEXT1, by itself, creates a new TEXT1 or raises the existing
% singleton*.
%
% H = TEXT1 returns the handle to a new TEXT1 or the handle to
% the existing singleton*.
%
% TEXT1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TEXT1.M with the given input arguments.
%
% TEXT1('Property','Value',...) creates a new TEXT1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before text1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to text1_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help text1
% Last Modified by GUIDE v2.5 29-May-2020 17:35:06
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @text1_OpeningFcn, ...
'gui_OutputFcn', @text1_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before text1 is made visible.
function text1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to text1 (see VARARGIN)
% Choose default command line output for text1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes text1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = text1_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in point.
function point_Callback(hObject, eventdata, handles)
% hObject handle to point (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=('.');
textstring=strcat(OLDstring,NEWstring);
set(handles,text1,'string', textstring);
% --- Executes on button press in divison.
function divison_Callback(hObject, eventdata, handles)
% hObject handle to divison (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=('/');
textstring=strcat(OLDstring,NEWstring);
set(handles,text1,'string', textstring);
% --- Executes on button press in pi.
function pi_Callback(hObject, eventdata, handles)
% hObject handle to pi (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=('pi');
textstring=strcat(OLDstring,NEWstring);
set(handles,text1,'string', textstring);
% --- Executes on button press in power.
function power_Callback(hObject, eventdata, handles)
% hObject handle to power (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=('^');
textstring=strcat(OLDstring,NEWstring);
set(handles,text1,'string', textstring);
% --- Executes on button press in tan.
function tan_Callback(hObject, eventdata, handles)
% hObject handle to tan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.text1,'string');
textstring=strcat(textstring, 'tan(pi/180*');
set(handles.text1,'string', textstring);
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (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=(')');
textstring=strcat(OLDstring,NEWstring);
set(handles,text1,'string', textstring);
% --- Executes on button press in two.
function two_Callback(hObject, eventdata, handles)
% hObject handle to two (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=('2');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in six.
function six_Callback(hObject, eventdata, handles)
% hObject handle to six (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=('6');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in clear.
function clear_Callback(hObject, eventdata, handles)
% hObject handle to clear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.text1, 'string','');
% --- Executes on button press in five.
function five_Callback(hObject, eventdata, handles)
% hObject handle to five (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=('5');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in nine.
function nine_Callback(hObject, eventdata, handles)
% hObject handle to nine (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=('9');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in subtraction.
function subtraction_Callback(hObject, eventdata, handles)
% hObject handle to subtraction (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=('-');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- 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);
% --- Executes on button press in cosine.
function cosine_Callback(hObject, eventdata, handles)
% hObject handle to cosine (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.text1,'string');
textstring=strcat(textstring, 'cos(pi/180*');
set(handles.text1,'string', textstring);
% --- Executes on button press in pushbutton0.
function pushbutton0_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton0 (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=('(');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in multiplication.
function multiplication_Callback(hObject, eventdata, handles)
% hObject handle to multiplication (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=('*');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in eight.
function eight_Callback(hObject, eventdata, handles)
% hObject handle to eight (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=('8');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in addition.
function addition_Callback(hObject, eventdata, handles)
% hObject handle to addition (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=('+');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in four.
function four_Callback(hObject, eventdata, handles)
% hObject handle to four (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=('4');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in sin.
function sin_Callback(hObject, eventdata, handles)
% hObject handle to sin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.text1,'string');
textstring=strcat(textstring, 'sin(pi/180*');
set(handles.text1,'string', textstring);
% --- Executes on button press in equal.
function equal_Callback(hObject, eventdata, handles)
% hObject handle to equal (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
textstring=get(handles.text1,'string')
textstring=eval(textstring)
set(handles.text1,'string',textstring);
% --- Executes on button press in zero.
function zero_Callback(hObject, eventdata, handles)
% hObject handle to zero (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=('0');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in three.
function three_Callback(hObject, eventdata, handles)
% hObject handle to three (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=('3');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
% --- Executes on button press in seven.
function seven_Callback(hObject, eventdata, handles)
% hObject handle to seven (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=('7');
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string', textstring);
set(handles.text1,'callback',{@OLDstring_callback,Handling})
set(handles.text1,'callback',{@NEWstring_callback,Handling})
function frequency_axes_Createfcn(varargin)
ERRORS :
Reference to non-existent field 'text1'.
Error in text1>five_Callback (line 167)
OLDstring=get(handles.text1,'string');
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in text1 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)text1('five_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
please help me, my deadline is tomorow
Best regards

답변 (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