How to set the output port type in dependence on an parameter - S Function
古いコメントを表示
Hello,
i'm trying to write an S-Function which allows to set the output port type dependence on one of the parameter? What i already tried:
static void mdlOutputs(SimStruct *S, int_T tid)
{
DTypeId y0DataType = ssGetSFcnParam(S,2);
switch(y0DataType)
{
case SS_INT8:
{
int8_T *pY0 = (int8_T *)ssGetOutputPortSignal(S,0);
pY0[0] = 0;
break;
}
case SS_UINT8:
{
uint8_T *pY0 = (uint8_T *)ssGetOutputPortSignal(S,0);
pY0[0] = 13;
break;
}
default:
{
uint8_T *pY0 = (uint8_T *)ssGetOutputPortSignal(S,0);
pY0[0] = 7;
}
}
}
I can compile it and run the corresponding simulink model, but it doesn't work. Can me tell anyone why?
Regards V.Sadiku
3 件のコメント
Jordan Monthei
2013 年 5 月 10 日
Could you go into more detail as to how it does not work? Is there an error that occurs during simulation? Is it not outputting as you would expect, in which case, what are you expecting and what are you seeing?
Valmir Sadiku
2013 年 5 月 10 日
Valmir Sadiku
2013 年 5 月 10 日
編集済み: Valmir Sadiku
2013 年 5 月 10 日
回答 (1 件)
William James
2013 年 6 月 3 日
hello,
i met the problem as you ! if you resolved it ,please tell me how to set the output type .
thank you with Hz
1 件のコメント
Kaustubha Govind
2013 年 6 月 3 日
Do you validate the value entered for the parameter is a valid datatype ID before configuring it as the output datatype in mdlInitializeSizes?
カテゴリ
ヘルプ センター および File Exchange で Simulink Coder についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!