Error setting property 'String' of class 'UIControl' method lin bairstow

11 次查看(过去 30 天)
Hello! How are you. As you can see in the image, the matlab throws me an error in my script then I leave the code to tell me what's wrong with me, please I took a little time in Matlab and I really do not know how to solve this problem. i'm working in gui of matlab
% --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles)
a=zeros(1,7);
b=zeros(1,7);
c=zeros(1,7);
a(1,3)=str2double(get(handles.edit2,'string'));
a(1,4)=str2double(get(handles.edit3,'string'));
a(1,5)=str2double(get(handles.edit4,'string'));
a(1,6)=str2double(get(handles.edit5,'string'));
a(1,7)=str2double(get(handles.edit6,'string'));
r=str2double(get(handles.edit13,'string'));
s=str2double(get(handles.edit12,'string'));
ciclos=str2double(get(handles.edit11,'string'));
for k=1:1:ciclos
syms dr ds; for i=3:1:7 b(1,i)=a(1,i)+r*b(1,i-1)+s*b(1,i-2); end
for j=3:1:7
c(1,j)=b(1,j)+r*c(1,j-1)+s*c(1,j-2);
end
E1=c(1,5)*dr+c(1,4)*ds==-b(1,6);
E2=c(1,6)*dr+c(1,5)*ds==-b(1,7);
[dr,ds]=(solve(E1,E2));
B=b;
C=c;
Deltas=[vpa(dr,4),vpa(ds,4)];
r=r+dr;
s=s+ds;
end
vpa(r,5);
vpa(s,5);
vpa(dr,4);
vpa(ds,4);
set(handles.edit7,'string',r);
set(handles.edit8,'string',s);
set(handles.edit9,'string',dr);
set(handles.edit10,'string',ds);
% --- Executes on button press in pushbutton2.

采纳的回答

Erwin Avendaño
Erwin Avendaño 2017-11-3
I'll try it later, the way I solved it is that the system of equations solved it with matrices (gauss jordan) and did not use the solve command for the system of equations. Thank you for answered

更多回答(1 个)

Steven Lord
Steven Lord 2017-11-2
You can't set the String property of a UIControl to contain a symbolic expression directly. Either convert the symbolic expression to a numeric array using double (this will NOT work if the expression contains a symbolic variable) or convert it into a char vector using char and set the result as the value of the String property.
  1 个评论
Erwin Avendaño
Erwin Avendaño 2017-11-2
I'll try it later, the way I solved it is that the system of equations solved it with matrices (gauss jordan) and did not use the solve command for the system of equations. Thank you for answered

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by