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?

조회 수: 6 (최근 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