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 次查看(过去 30 天)
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'.

回答(1 个)

Mark McBroom
Mark McBroom 2018-4-4
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

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by