How can I resolve "Warning: Support of character vectors that are not valid variable names or define a number will be removed in a future release. To create symbolic expressions, first create symbolic variables and then use operations on them."
5 次查看(过去 30 天)
显示 更早的评论
I need to develop a graphical interface but I have a problem, every time I execute the guide I get the warning of the following image, omitting the warning is shown correctly and shows what I want. This project I need to package it to make an independent application to use it in computers without matlab, the detail is that when I package it, install it and execute it, it does not do what I want, I suppose it is because of that warning, someone could help me?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192673/image.jpeg)
this is my graphic interfase, we need to fill in data on table and when I push "resolver" butom, code gets data and process it then shows the result on axes.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192675/image.jpeg)
this is my "resolver" buttom code: (on warning appear "resolver1" it's resolver "butom")
if true
%function resolver1_Callback(~, ~, handles)
global Px Py Pz vector gdl i
filas = str2double(get(handles.eslabones,'String'));
filas=filas-1;
F = sym('A', [filas 4]);
H = eye(4);
C = sym('C', [4 4]);
A=(get(handles.uitable1,'Data'));
med = str2double(get(handles.gradrad,'String'));
if med == 2
for i=1:filas
c1=(A(i,1));
c2=(A(i,2));
c3=(A(i,3));
c4=(A(i,4));
F(i,1)=c1;
F(i,2)=c2;
F(i,3)=c3;
F(i,4)=c4;
C = simplify([cos(F(i,4)) -sin(F(i,4))*cos(F(i,2)) sin(F(i,4))*sin(F(i,2)) F(i,1)*cos(F(i,4));
sin(F(i,4)) cos(F(i,4))*cos(F(i,2)) -cos(F(i,4))*sin(F(i,2)) F(i,1)*sin(F(i,4));
0 sin(F(i,2)) cos(F(i,2)) F(i,3);
0 0 0 1]);
H=H*C;
end
else
for i=1:filas
c1=(A(i,1));
c2=(A(i,2));
c3=(A(i,3));
c4=(A(i,4));
F(i,1)=c1;
F(i,2)=c2;
aux1=degtorad(F(i,2));
F(i,2)=aux1;
F(i,3)=c3;
F(i,4)=c4;
aux1=degtorad(F(i,4));
F(i,4)=aux1;
C=simplify([cos(F(i,4)) -sin(F(i,4))*cos(F(i,2)) sin(F(i,4))*sin(F(i,2)) F(i,1)*cos(F(i,4));
sin(F(i,4)) cos(F(i,4))*cos(F(i,2)) -cos(F(i,4))*sin(F(i,2)) F(i,1)*sin(F(i,4));
0 sin(F(i,2)) cos(F(i,2)) F(i,3);
0 0 0 1]);
H=H*C;
end
end
exp = str2double(get(handles.export,'String'));
if exp == 2
filas = str2double(get(handles.eslabones,'String'));
filas = filas-1;
if filas <4
Px = H(1,4);
Py = H(2,4);
Pz = H(3,4);
vector = Px+Py+Pz;
gdl = filas;
if vector == 0
errordlg('No hay datos que exportar, realice primero el análisis para poder exportar.', 'Error');
else
close(Cine_direc);
Dinamica;
msgbox('Datos exportados correctamente.', 'Información');
end
else
errordlg('No se pueden exportar datos cuando son más de 3 GDL', 'Error');
end
else
A = latex(H);
axes(handles.axes1)
axis off;
cla
text('interpreter', 'latex', ...
'String', ['$$', char(A), '$$'], ...
'Position', [.25 .25], ...
'FontSize', 10)
end
Thank you
0 个评论
采纳的回答
Walter Roberson
2018-10-26
"This project I need to package it to make an independent application to use it in computers without matlab"
It is not possible to use MATLAB Compiler or MATLAB Coder with the Symbolic Toolbox.
You can use the Symbolic Toolbox in interactive mode to create formulas that you can write out to files as numeric procedures using matlabFunction(), and those numeric functions can then be compiled into a project.
Looking at your code, it appears to me that you are calculating rotation matrices based upon numeric data, but that you are using symbolic form so that you can get nice presentation such as cos(17*pi/58) [for example] instead of 0.605174215193765 . If presentation is indeed key to your GUI then you will need to work through the calculations yourself, simulating polynomial multiplications. If numeric result is fine, then you will have a much easier time.
3 个评论
Walter Roberson
2018-10-27
"Would there be any way for you to package the application and make use of the symbolic toolbox?"
No.
"Any suggestions to be able to package the application being able to make use of any data that is entered in the table?"
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!