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 views (last 30 days)
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'.

Answers (1)

Mark McBroom
Mark McBroom on 4 Apr 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

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!