Can you force Simulink Parameters and Signals to be declared in model_private.h when they're not used in the model during code generation?

2 visualizaciones (últimos 30 días)
When I try to generate code for my Simulink model, any of the data dictionary items that aren't used inside the model do not get declared. Is there a way to force declarations of these Simulink Parameters and Signals?
In my particular application, I would like to generate declarations inside the generated model_private.h for all data dictionary items regardless if they're actually used in my model. The data dictionary items are set to a storage class of 'importedExtern'.

Respuestas (1)

Mark McBroom
Mark McBroom el 4 de Abr. de 2018
I don't think this is possible. A possible workaround could be:
1. Write some MATLAB code to read the data dictionary and write out extern statements to a header file ( i.e. myHeader.h ) for all signals and parameters. You'll need to use the Simulink data dictionary APIs.
2. Modify the storage classes to be ImportFromFile for each signal and parameter.
3. Set the Storage Class Custom Attribute "HeaderFile" to be myHeader.h for each signal and parameter

Categorías

Más información sobre Deployment, Integration, and Supported Hardware 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!

Translated by