Can I use MATLAB Coder on .mlapp files?

2 vues (au cours des 30 derniers jours)
Michael
Michael le 17 Oct 2018
Réponse apportée : Kanishk le 11 Juil 2025
I have used the MATLAB App Designer to put together a GUI that works. I have seen that you can use MATLAB Compiler to create an executable from the App, but I don't have that toolbox so that's not a viable option for me. I am wondering whether I can generate C++ code for this App using MATLAB Coder. I've never used the toolbox before but it appears that MATLAB Coder can generate C++ code for MATLAB classes and functions and it's my understanding that that's what's under the hood for a .mlapp file, but I'm not seeing a workflow that gets me from a working .mlapp file to generated C++ code. Is there one?
  1 commentaire
Adam
Adam le 17 Oct 2018
Modifié(e) : Adam le 17 Oct 2018
I very much doubt it. A .mlapp file is fundamentally a UI with the underlying code and you can't turn a UI into C++ code via Coder, whatever source it comes from.
Classes are supported via Coder, but the ui components inside it will not be.

Connectez-vous pour commenter.

Réponses (1)

Kanishk
Kanishk le 11 Juil 2025
Hello Michael,
I understand you are want to generate C++ code from a MATLAB App Designer application using MATLAB Coder.
The MATLAB Coder does not support code generation for graphical user interfaces (GUIs) created with App Designer or any other GUI development tools in MATLAB. This includes ".mlapp" files, which encapsulate UI components such as buttons, axes, and callbacks using objects like uifigure, and uibutton. These graphical and event-driven components are not supported by MATLAB Coder’s code generation capabilities.
However, if your app includes underlying computational logic (e.g., algorithms, processing routines) that is independent of the UI, there is a viable workflow:
  1. Refactor the core algorithmic logic from your app into one or more standalone MATLAB functions that do not rely on any GUI elements.
  2. Use MATLAB Coder to generate C or C++ code from those standalone functions. You can do this either via the MATLAB Coder app or programmatically using the codegen command.
  3. If needed, the generated C++ code can then be integrated into a C++ application or a custom GUI built in another environment.
You can read more about generating computational logic for GUI based application from this MATLAB answer.
Cheers!

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by