필터 지우기
필터 지우기

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