- https://mathworks.com/help/simulink/sfg/integrating-existing-c-functions-into-simulink-models-with-the-legacy-code-tool.html
- https://mathworks.com/help/rtw/examples/calling-c-object-methods-functions-in-simulink.html
C++ class interface for Simulink and MATLAB with support for code generation
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a large C++ class implementing a dynamic model. I'm trying to find a simple way to interface this class so that other people can use it from MATLAB and Simulink.
An important requirement is that the Simulink models using the C++ class supports code generation.
Another constraint is given by the way the C++ class is used. To initialize the C++ class one calls several member functions and their order and usage depends on the particular situation. I would like to give the same initialization flexibility also inside Simulink.
Which is the best way to tackle this problem?
Thanks
Carlo
0 comentarios
Respuestas (2)
Joachim Schlosser
el 8 de Abr. de 2016
Editada: Joachim Schlosser
el 8 de Abr. de 2016
Please check the Legacy Code Tool that supports also code generation:
You may need to write some functions for the different situations that perform the initialization calls. Also check the note on classes at the end of the first page.
0 comentarios
Zack Peters
el 8 de Abr. de 2016
Hi Carlo,
Most of our customers achieve this through C-MEX S-functions. To support code generation you will also need to write a corresponding TLC file for your S-functions.
If you've never used an S-function before, it can be a tough learning process. Here is the landing page to get started:
You may be able to the Legacy Code Tool to get your s-function framework started in the correct direction:
~Zack
0 comentarios
Ver también
Categorías
Más información sobre Simulink Coder en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!