필터 지우기
필터 지우기

How to input a boolean to a C s-function

조회 수: 2 (최근 30일)
samil
samil 2011년 5월 5일
I can input boolean data into a C s-function by defining it as an int32 (see code below). How do I input boolean data with SS_BOOLEAN or SS_UINT8 type? I specified the signal data type explicitly in my Simulink model and s-function but when I defined the data as boolean or uint8, I got strange numbers instead of 1 or 0.
static void mdlInitializeSizes( SimStruct *S )
{
...
ssSetInputPortRequiredContiguous(S, 0, true);
ssSetInputPortDataType(S, 0, SS_INT32);
...
}
static void mdlOutputs( SimStruct *S, int_T tid )
{
const int *myBoolean = (const int*) ssGetInputPortSignal( S, 0 );
...
}
  댓글 수: 1
Kaustubha Govind
Kaustubha Govind 2011년 5월 5일
Do you also convert the corresponding input to boolean or uint8 when you change the S-function input port data? If yes, how do you achieve this conversion?

댓글을 달려면 로그인하십시오.

답변 (0개)

제품

Community Treasure Hunt

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

Start Hunting!

Translated by