필터 지우기
필터 지우기

Create non-default constructor

조회 수: 3 (최근 30일)
db1024
db1024 2020년 3월 23일
Hi,
I am generation a C++ class from a Simulink model using Embedded coder. Therefore, I set the corresponding parameter code interface packaging to C++ class [1].
The generated C++ class always contains a default constructor like
// Constructor
MyModelClass::MyModelClass()
{
static const P_MyParam_t MyParam_P_temp = {
// Variable: Param
// Referenced by:
// '<S1>/Constant1'
// '<S1>/Constant2'
{
1.0F,
0.2F
}
}; // Modifiable parameters
// Initialize tunable parameters
MyParam_P = MyParam_P_temp;
}
where MyParam_P is a member variable of the generated C++ class.
Is there a way to generate a non-default constructur similar to the following code snippet?
// Constructor
MyModelClass::MyModelClass(const P_MyParam_t* MyParam_P_temp)
{
// Initialize tunable parameters
MyParam_P = *MyParam_P_temp;
}
Thank you for your help!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by