matlab standalone desktop app stuck in syms command

조회 수: 2 (최근 30일)
Wong Slocked
Wong Slocked 2021년 8월 24일
편집: Wong Slocked 2021년 8월 25일
Hi there, I encountered a problem developing a matlab app.
When I debug in the matlab app designer, no problem occurred, so I generated the standalone desktop app.
However when I run the deployed the standalone desktop app, it appears that it got stuck somewhere, not being able to display the right results.
Since a standalone app is quite hard to debug, I have to write a log file for the app and the self-written class invoked, to check which line the app had stopped. (BTW is there a more efficient way to debug in a situation like this?)
I found the app stopped in the self-written class invoked. The context code is as follows.
fid = fopen('D:\Matlab App License\create_polylog.txt','w+');
fprintf(fid,"0\r\n");
n = obj.order;
obj.coef_table=string(zeros(n+1,4));
obj.index = [];
fprintf(fid,"1\r\n");
syms 'p%d' [1,n]
syms x y p0
poly = p0;
fprintf(fid,"2\r\n");
where the log file result is,
0
1
It seems the app stops trying to create a syms object? Is there anything I can do to debug this?
Thanks a lot.

채택된 답변

Steven Lord
Steven Lord 2021년 8월 24일
Creation of symbolic expressions using sym or syms is not supported in MATLAB Compiler as stated on this documentation page. Perform the symbolic calculations and generate a MATLAB function file using matlabFunction in MATLAB then include the generated function file in your deployed app.
  댓글 수: 3
Steven Lord
Steven Lord 2021년 8월 24일
Use isdeployed to determine if the code is running as a deployed application or not. If it is you cannot use sym or syms and will need to run an alternate code. One way to create that alternate code as a separate function file is using matlabFunction ahead of time.
Wong Slocked
Wong Slocked 2021년 8월 25일
편집: Wong Slocked 2021년 8월 25일
Thanks again.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by