Main Content

ssSetSFcnParamUnit

Specify unit of S-function block parameter

Since R2024a

Syntax

UnitId ssSetSFcnParamUnit(SimStruct *S, int_T parIdx, UnitId id);

5

Arguments

S

SimStruct that represents an S-Function block.

parIdx

Index of the parameter.

id

ID of the unit accepted by parameter. This ID is returned from the ssRegisterUnitFromExpr method.

Returns

The unit ID specified by id. Returns -1 if id is DYNAMICALLY_TYPED.

Description

Use in mdlInitializeSizes (after ssSetNumSFcnParams) to specify the unit for each parameter of the S-function. Parameter index numbers start at 0 and end at the total number of parameters minus 1 (0 to total number of parameters - 1).

Languages

C, C++

Examples

UnitId pUnitIdReg;
  
ssRegisterUnitFromExpr(S, PARAMETER_0_UNIT, &pUnitIdReg);
if (pUnitIdReg != INVALID_UNIT_ID) 
{
    ssSetSFcnParamUnit(S, 0, pUnitIdReg);
} 
else 
{
    ssSetLocalErrorStatus(S, "Invalid Unit provided for parameter for S-Function");
    return;
}

Version History

Introduced in R2024a