필터 지우기
필터 지우기

Using MATLAB Class with coder.ceval calls in App designer

조회 수: 4 (최근 30일)
Noah Wölki
Noah Wölki 2020년 5월 7일
편집: Sean de Wolski 2020년 5월 8일
Hello People,
i am trying to use a MATLAB class inside of my App designer application. The usage of the class works fine as in debug mode the objects are created correctly.
Some of the functions in the MATLAB class use coder.ceval function as some C-code is used. The Class works fine when using the corresponding Simulink Block in Simulink Compiler.
Trying to compile the Standalone Applikation i always get the error: coder.ceval is not supported in MatLab.
Inside the Class i am using coder.cinclude correctly and also coder.updateBuildInfo.
Can anyone tell me what the Problem might be? Is the Standalone Applikation not compiled?
Thanks for the help, best regards

채택된 답변

Denis Gurchenkov
Denis Gurchenkov 2020년 5월 7일
Hi Noah, you are correct.
Some background:
  1. MATLAB Compiler (standalon application) is NOT a compiler. It is a deployment tool that packages MATLAB and your program into a single application. When the application runs, the MATLAB is started and your program is executed. So, if your program does not run in MATLAB, it will not run in MATLAB Compiler (Standalone Application) either.
  2. coder.ceval is a function that only works in code generation products (MATLAB Coder and MATLAB blocks in Simulink that use code generation mode, such as MATLAB Fucntion block). That's why your program works fine inside Simulink or inside Simulink compiler, because coder.ceval is supported there, but not supported in MATLAB itself.
Now, what can you do:
  1. You can use MATLAB Coder to generate a MEX file for your function that contains coder.ceval, and then deploy that MEX file as part of your application.
  2. Or you can rewrite the program (the part that uses coder.ceval) to avoid using C code.
  3. You can also use clibgen (MATLAB's C/C++ interface) instead of coder.ceval, though I am afraid you may lose Simulink compatiblity then.
  4. You can also use coder.target to have conditional code to use ceval in Simulink and some other solution in pure MATLAB.
Overall, I don't see an easy solution for your case, as there is currently no simple way to get MATLAB/C integration that works with both MATLAB and Simulink and both compilers. I'll bring this to the MATLAB development team as a feature request for future release.
  댓글 수: 3
Denis Gurchenkov
Denis Gurchenkov 2020년 5월 8일
Hi Noah, I wish I could change these names! The names are misleading, they are just old historic names.
MATLAB Compiler (mcc) is really a deployment tool, it should be named "mappdeploy" or something like that, it is not a compiler, as you said. It is named "compiler" because many years ago, the very first generation of mcc was indeed a compiler, but that was re-implemented as a deployment/packaging tool more than 15 years ago, but the name remained.
MATLAB Coder (codegen) is really a via-C compiler. It was named Coder because the "compiler" name was already taken by mcc.
Sean de Wolski
Sean de Wolski 2020년 5월 8일
편집: Sean de Wolski 2020년 5월 8일
MATLAB Coder is a MATLAB>C/C++ Transpiler! I wish that word was more common.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by