Using MATLAB Class with coder.ceval calls in App designer

7 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Denis Gurchenkov
Denis Gurchenkov el 7 de Mayo de 2020
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 comentarios
Denis Gurchenkov
Denis Gurchenkov el 8 de Mayo de 2020
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 el 8 de Mayo de 2020
Editada: Sean de Wolski el 8 de Mayo de 2020
MATLAB Coder is a MATLAB>C/C++ Transpiler! I wish that word was more common.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by