Embedded coder on m-files (without simulink)
Afficher commentaires plus anciens
Is matlab coder and embedded coder suitable to generate c code (for embedded target) from an m-file, and if so, how? I only find examples involving simulink, but is there a way to do this from command line (achieving rtwbuild with ert on m-file only).
If done form within Simukink om an Matlab System block only, is Simulink coder necessary?
Réponse acceptée
Plus de réponses (2)
Denis Gurchenkov
le 28 Jan 2019
1 vote
MATLAB Coder is exacrtly the tool that takes an .m file and genrates C code from it. If all you want is MATLAB-to-C conversion, then you don't need Simulink or Simulink Coder at all. If you go to https://www.mathworks.com/products/matlab-coder.html and start from there, there are tutorials, webinars and all that reachable from that page (you do need to create a free MathWorks account to get to the doc, though).
If you have a Simulink model with a single MATLAB Function Block in it and you want to generate C code, then you do need Simulink Coder. But if you took the body of that block, saved it in an .m file, then you could feed that file to MATLAB Coder and then you don't need Simulink Coder.
Andreas Johansson
le 29 Jan 2019
0 votes
1 commentaire
Denis Gurchenkov
le 29 Jan 2019
If you have a license for Embedded Coder, it unlocks extra features in both SL and ML Coders, allowing for greater customization of generated code (things like naming style for variables). You can always generate C code without Embedded Coder (via either SL or ML coder, depending on your source language -- Simulink or MATLAB), and Embedded Coder only is necessary if there is some particular feature (like code customization, interfacing with extrenal C code etc) that you need -- many such features get unlocked / become visible in configuration menus only if Embedded Coder license is available.
Can you elaborate on what you mean by "embedded coder can be hooked on to this chain"? If you have both ML and Embedded Coder licenses, they would work together just fine, but the real question is, what is the feature or capability of Embedded Coder that you really need.
To sum it up, perhaps you should try first to generate C code using ML coder alone. If taht works (C code is generated and does what you want) then you decide if you want/need to try EC or not.
Catégories
En savoir plus sur Deployment, Integration, and Supported Hardware dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!