How can I generate separate cpp files for each subsystem in my simulinkk model using embedded coder?

1 visualización (últimos 30 días)
I want to introduce modularity to my simulink model and hence want each simulink block to be translated to a cpp file using Embedded Coder.What I did was this: 1. Created a simlink model with n blocks 2. Wrapped each significant simulink block to a subsystem 3. Set the Subsystem parameters 'treat as atomic unit' and 'Function Reuse" 4. Built the model.
I was expecting n soucefiles for each of my subsystem.But I got only one relevant soucefile with the name of my simulink model. Is there something I am missing? your help will be appreciated.

Respuestas (1)

Juan Reyes
Juan Reyes el 16 de Jun. de 2016
Editada: Juan Reyes el 16 de Jun. de 2016
Use TLC functionalities
You may need to add a customized TLC. If you are using an ERT target try going to: Model Configuration Parameters -> Code Generation -> Templates.
In Custom Templates browse your customized file "MyTlc.tlc" which you should have created in your working directory.
Try writing this inside "MyTlc.tlc":
%%%%MyTLC.tlc
%assign name = "MyDesiredSourceFile"
%assign cFile = LibCreateSourceFile("Source", "Custom", "name")
%openfile contentBuf
.....The content you want in foo.c**....
You can acces all your model parameters using the model.rtw file
%closefile contentBuf
%<LibSetSourceFileSection(cFile,"Functions",contentBuf)>
More info in:

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by