MATLAB Answers

"Reference to non-existent field 'Tabel1'"

4 views (last 30 days)
Hi, im new in matlab, these are my codes,
%Kosongkan Tampilan
set(handles.InputA,'string','');
set(handles.InputB,'string','');
set(handles.InputC,'string','');
set(handles.InputD,'string','');
set(handles.InputE,'string','');
set(handles.InputF,'string','');
set(handles.Inputx1,'string','');
set(handles.Inputx2,'string','');
set(handles.x1final,'string','');
set(handles.x2final,'string','');
set(handles.InputTeliti,'string','');
%Ambil Data
A=str2double(get(handles.InputA,'string'));
B=str2double(get(handles.InputB,'string'));
C=str2double(get(handles.InputC,'string'));
D=str2double(get(handles.InputD,'string'));
E=str2double(get(handles.InputE,'string'));
F=str2double(get(handles.InputF,'string'));
x01=str2double(get(handles.Inputx1,'string'));
x02=str2double(get(handles.Inputx2,'string'));
T=str2num(get(handles.InputTeliti,'string'));
%Inisialisasi Variabel
syms x x1 x2 L FL
%Program Utama
x=[x01 x02];
FX=A*x1^2+B*x2^2+C*x1*x2+D*x1+E*x2+F;
VF=[2*A*x(1)+C*x(2)+D;2*B*x(2)+C*x(1)+E];
norm=sqrt(VF(1)^2+VF(2)^2);
d=VF*-1;
xn=[x(1)+L*d(1);x(2)+L*d(2)];
FL=A*xn(1)^2+B*xn(2)^2+C*xn(1)*xn(2)+D*xn(1)+E*xn(2)+F;
Lamda=solve(diff(FL,L),0);
xn=[x(1)+Lamda*d(1);x(2)+Lamda*d(2)];
%Mengisi Tabel
set(handles.Tabel1,'data',num2cell(x(1)));
guidata(hObject, handles);
while double(norm) > double(T)
x=xn
VF=[2*A*x(1)+C*x(2)+D;2*B*x(2)+C*x(1)+E];
norm=sqrt(VF(1)^2+VF(2)^2);
d=VF*-1;
xn=[x(1)+L*d(1);x(2)+L*d(2)];
FL=A*xn(1)^2+B*xn(2)^2+C*xn(1)*xn(2)+D*xn(1)+E*xn(2)+F;
Lamda=solve(diff(FL,L)==0,L);
xn=[x(1)+Lamda*d(1);x(2)+Lamda*d(2)];
Data=[norm xn(1) xn(2) Lamda];
set(handles.Tabel,'string',Data);
guidata(hObject, handles);
end
it's a steepest descent code, and when I pushed the push button, it said: Reference to non-existent field 'Tabel1'.
Error in SDNyoman>MULAI_Callback (line 144)
set(handles.Tabel1,'data',num2cell(x(1)));
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in SDNyoman (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)SDNyoman('MULAI_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Thank you.

  0 Comments

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 24 Nov 2012
Are you sure you didn't misspell it? Are you sure it's not Table1 instead of Tabel1?

  11 Comments

Show 8 older comments
nypradjna
nypradjna on 24 Nov 2012
Name Size Bytes Class Attributes
hasil 1x4 60 sym
That's the result. It means that hasil is a sym, so it should be converted to numeric before inserted to the table (?)
Image Analyst
Image Analyst on 24 Nov 2012
I don't know - I don't have that toolbox. Did you try this:
hasil = double(hasil);
If that doesn't work, then I don't know. I added the Symbolic Math Toolbox to the products tag. You should do this when you make up the question initially.

Sign in to comment.

More Answers (0)


Translated by