Simulink Codegen Model Parameter Static Keyword

11 Ansichten (letzte 30 Tage)
Kraker
Kraker am 2 Aug. 2025
Beantwortet: Aabha am 19 Aug. 2025 um 10:56
Hi,
Short question:
Can simulink generate code (ert and c++ class) without the "static" keyword for the model parameters?
Details:
For analysis, I want to generate code from the Simulink model and run it in parallel. I also want to change the parameters for each run. However, at the end of the code generation, the Simulink parameters are generated with static keyword.
Simple model for demonstration:
In the simulink model "seed" parameter is defined in constant block and initialized from matlab script as shown:
seed = uint32(0);
seed = Simulink.Parameter(seed);
seed.StorageClass = 'Model default';
Simulink model:
And the generated code (with ert config and C++ class):
class simpleModel
{
public:
...
struct P_simpleModel_T {
uint32_T seed;
};
...
static P_simpleModel_T simpleModel_P;
...
So the question is that is there any way generate code without the static keyword for the model parameters?

Antworten (1)

Aabha
Aabha am 19 Aug. 2025 um 10:56
You can refer to the following MATLAB answer link, which explains the procedure for make the model parameters 'non-static':
I hope it answers your question.

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by