How can I make block parameters appear as class members of the generated C++ class?

3 Ansichten (letzte 30 Tage)
I have a model which uses variables defined in the workspace. I am generating C++ Class code from this model. I would like the workspace variables to appear as class data members inside the C++ class, that also can be tuned.
What storage class or settings do I need to achieve this?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 26 Jul. 2023
Bearbeitet: MathWorks Support Team am 26 Jul. 2023
The options depend on whether you need instance-specific or shared parameters.

Shared between instances of the class

If you are okay with the parameter values being the same for all instances of the class, then you have 2 options:
  1. Store the parameter in the Base Workspace or a Data Dictionary and set the storage class to Model Default. This option only works if you have no referenced models.
  2. Store the parameter in the Model Workspace and set the Default Parameter Behavior to Tunable. You don't necessarily need a Simulink.Parameter for this option, because all parameters will be tunable in the code and will show up in the model class

Instance-specific parameters

Weitere Antworten (0)

Kategorien

Mehr zu Code Interface Definitions finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by