if matlab does not signal me any error but in the .exe file does not work how can I write this code in another way?

1 次查看(过去 30 天)
How could I write this code in another way? Do you need the str2double? I put it to get the numerical value
function pushbutton3_Callback(~, ~, handles)
syms x %variable simbolica x
f=get(handles.edit8,'string');
xl=str2double(get(handles.edit3,'string'));
xu=str2double(get(handles.edit5,'string'));
tol=str2double(get(handles.edit4,'string'));
E=100;
xa=100;
i=0;
while(tol<E)
xr=(xl+xu)/2;
fxl=subs(f,x,xl);
fxr=subs(f,x,xr);
m=fxl*fxr;
if(m)<0
xu=xr;
else
xl=xr;
end
E=abs(xr-xa);
xa=xr;
i=i+1;
end
xr;
vpa(E,5)
set(handles.edit6,'string',xr);
set(handles.edit9,'string',E);
% --- Executes on button press in pushbutton4.

采纳的回答

Steven Lord
Steven Lord 2017-11-6
You're using functions from Symbolic Math Toolbox (in particular syms, subs, and vpa.) Symbolic Math Toolbox is not eligible for use with MATLAB Compiler.

更多回答(1 个)

Walter Roberson
Walter Roberson 2017-11-6
The cause of this is the same as https://www.mathworks.com/matlabcentral/answers/365294-does-my-code-have-an-error#answer_289606 . It even looks to me as if that is a duplicate question . Duplicate questions keep the volunteers spending time cleaning up questions instead of spending time answering the questions.
Not even a tiny bit of the Symbolic Toolbox can be compiled. The program will crash as soon as it encounters 'syms' or 'subs' or 'vpa'.
  1 个评论
Erwin Avendaño
Erwin Avendaño 2017-11-6
Ok, I understand, if I'm sorry it was a double question, I felt desperate to get an answer. So this code is not to make it executable? Okay, how could I make a code for an executable? Could you show me an example of how an executable code is?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by