sữa lỗi trong Guide

K

khanh_xl

Author
xin chào các pro!
số là e đang làm bài tập matlab, chương trình e làm xong thì chạy được, nhưng khi chạy nó báo cái lỗi này, e vẫn chưa biết sửa sao cho hoàn chỉnh. các pro nào đã từng biết thì cho e biết cách xử lí và sửa thế nào cho nó hết báo lỗi ạ!
??? Error using ==> feval
Undefined function or method 'kq_CreateFcn' for input arguments of type 'double'.


Error in ==> gui_mainfcn at 96
feval(varargin{:});


Error in ==> baitaplonMatlab_bai_1 at 25
gui_mainfcn(gui_State, varargin{:});


Error in ==> @(hObject,eventdata)baitaplonMatlab_bai_1('kq_CreateFcn',hObject,eventdata,guidata(hObject))



??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn


>> các trưởng bối giúp e nhé!
 
K

khanh_xl

Author
Ðề: sữa lỗi trong Guide

không bác nào giúp em hả? :17:
 
O

optionkill

Author
Ðề: sữa lỗi trong Guide

lỗi ở phần kq_CreateFcn. Bạn phải cho mọi người xem code cụ thể cơ. Chứ như thế thì cũng ko biết trong phần đấy bạn bị lỗi gì đâu.
 
K

khanh_xl

Author
Ðề: sữa lỗi trong Guide

vâng, đây là đoạn code của bài, các bác xem qua giúp em, mỗi lần bấm chạy là nó lại hiện lên cái lỗi như bên trên, e cũng chưa biết sao.

4/14/13 7:25 AM C:\
.m 1 of 6
% BAI TAP TIN HOC UNG DUNG: TINH TOAN VA VE CAC HAM LUONG GIAC THEO SO DO
% GVHD: NGUYEN VAN TAN
% SVTH: NGUYEN DUNG MINH KHANH - BUI HUU TAI
% TRUONG: DAI HOC DA NANG - DAI HOC BACH KHOA - KHOA DIEN
% NGÀY: 12/04/2013
function varargout = baitaplonMatlab_bai_1(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', [MENTION=5508]ba[/MENTION]itaplonMatlab_bai_1_OpeningFcn, ...
'gui_OutputFcn', [MENTION=5508]ba[/MENTION]itaplonMatlab_bai_1_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 baitaplonMatlab_bai_1 is made visible.
function baitaplonMatlab_bai_1_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for baitaplonMatlab_bai_1
handles.output = hObject;
handles.unit_input = 0;
handles.output=0;
% Update handles structure
guidata(hObject, handles);
% --- Outputs from this function are returned to the command line.
function varargout = baitaplonMatlab_bai_1_OutputFcn(hObject, eventdata, handles)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes during object creation, after setting button properties.
function ham_CreateFcn(hObject, eventdata, handles)
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get
(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
4/14/13 7:25 AM C:\
.m 2 of 6
end
% --- Executes during object creation, after setting button properties.
function input_CreateFcn(hObject, eventdata, handles)
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get
(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in degree.
function degree_Callback(hObject, eventdata, handles)
b = str2num(get(handles.input,'string'));
handles.unit_input = b*pi/180
guidata(hObject, handles)
% --- Executes on button press in radian.
function radian_Callback(hObject, eventdata, handles)
handles.unit_input = str2num(get(handles.input,'string'));
guidata(hObject, handles)
% --- Executes during object creation, after setting button properties.
function x_input_CreateFcn(hObject, eventdata, handles)
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get
(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in plotx.
function plotx_Callback(hObject, eventdata, handles)
set(handles.nhan,'Visible','on');
c=eval(get(handles.x_input,'string'));
if get(handles.ham,'Value') == 1;
plot(handles.axes1,c,sin(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 2;
plot(handles.axes1,c,cos(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 3;
plot(handles.axes1,c,tan(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 4;
plot(handles.axes1,c,cot(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 5;
plot(handles.axes1,c,asin(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 6;
plot(handles.axes1,c,acos(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 7;
plot(handles.axes1,c,atan(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 8;
plot(handles.axes1,c,acot(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 9;
4/14/13 7:25 AM C:\
.m 3 of 6
plot(handles.axes1,c,sinh(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 10;
plot(handles.axes1,c,cosh(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 11;
plot(handles.axes1,c,tanh(c),'LineWidth',2);
elseif get(handles.ham,'Value') == 12;
plot(handles.axes1,c,coth(c),'LineWidth',2);
end
if get(handles.grid,'Value') == 1
grid on
else
grid off
end
if get(handles.hold,'Value') == 1
hold on
else
hold off
end
% --- Executes on button press in grid.
function grid_Callback(hObject, eventdata, handles)
set(handles.axes1);
grid
% --- Executes on button press in hold.
function hold_Callback(hObject, eventdata, handles)
set(handles.axes1);
hold
% --- Executes on button press in ok.
function ok_Callback(hObject, eventdata, handles)
d=handles.unit_input
y=get(handles.ham,'Value')
if y==1;
e=sin(d)
elseif y==2;
e=cos(d)
elseif y==3;
e=tan(d);
elseif y==4;
e=cot(d);
elseif y==5;
e=asin(d);
elseif y==6;
e=acos(d);
elseif y==7;
e=atan(d);
elseif y==8;
e=acot(d);
elseif y==9;
e=sinh(d);
elseif y==10;
e=cosh(d);
4/14/13 7:25 AM C:\
.m 4 of 6
elseif y==11;
e=tanh(d);
elseif y==12;
e=coth(d);
end
if and(e<0.000001,e>-0.000001)
set(handles.kq,'string','0');
elseif or(e>1000,e<-1000)
set(handles.kq,'string','Math error');
else
set(handles.kq,'string',num2str(e));
end
guidata(hObject,handles)
% --- Executes on button press in clc.
function clc_Callback(hObject, eventdata, handles)
set(handles.input,'string','');
set(handles.kq,'string','');
set(handles.x_input,'string','');
set(handles.hold,'Value',0);
set(handles.grid,'Value',0);
set(handles.color,'Value',0);
set(handles.ham,'Value',1);
set(handles.axes1,'Visible','off');
set(handles.axes1);
cla;
set(handles.nhan,'Visible','off');
% --- Executes when user attempts to close button.
function all_CloseRequestFcn(hObject, eventdata, handles)
% Hint: delete(hObject) closes the figure
delete(hObject);
% --- Executes on button press in color.
function color_Callback(hObject, eventdata, handles)
if get(handles.color,'Value')==1;
set(handles.input,'BackgroundColor','b');
set(handles.kq,'BackgroundColor','y');
set(handles.all,'Color',[0.73,0.83,0.96]);
set(handles.option,'BackgroundColor',[1,0.69,0.39]);
set(handles.axes1,'Color',[0.95,0.87,0.73]);
set(handles.exit,'BackgroundColor','red');
else
set(handles.input,'BackgroundColor','white');
set(handles.kq,'BackgroundColor',[0.94,0.94,0.94]);
set(handles.all,'Color',[0.94,0.94,0.94]);
set(handles.option,'BackgroundColor',[0.94,0.94,0.94]);
set(handles.axes1,'Color','w');
set(handles.exit,'BackgroundColor',[0.94,0.94,0.94]);
end
4/14/13 7:25 AM C:\
.m 5 of 6
% --- Executes on button press in exit.
function exit_Callback(hObject, eventdata, handles)
set(handles.all,'Visible','off');
function x_input_Callback(hObject, eventdata, handles)
set(handles.plotx,'Enable','off');
try
t = eval(get(handles.x_input,'String'));
if ~isnumeric(t)
set(handles.plotx,'String','t is not numeric')
elseif length(t) < 2
set(handles.plotx,'String','t must be vector')
elseif min(diff(t)) < 0
set(handles.plotx,'String','t must increase')
else
set(handles.plotx,'String','Plot')
set(handles.plotx,'Enable','on')
return
end
catch
set(handles.plotx,'String','Cannot plot t');
end
% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes1
% --- Executes on button press in GIO.
function GIO_Callback(hObject, eventdata, handles)
% hObject handle to GIO (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
DONGHO
% --- Executes during object deletion, before destroying properties.
function degree_DeleteFcn(hObject, eventdata, handles)
% hObject handle to degree (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
4/14/13 7:25 AM C:\
.m 6 of 6
function degree_CreateFcn(hObject, eventdata, handles)
% hObject handle to degree (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on key press with focus on degree and none of its controls.
function degree_KeyPressFcn(hObject, eventdata, handles)
% hObject handle to degree (see GCBO)
% eventdata structure with the following fields (see UICONTROL)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles structure with handles and user data (see GUIDATA)
 
Top