Determine whether a data type identifier represents a bus
int_T ssIsDataTypeABus(S, int_T typeID)
S
SimStruct that represents an S-Function block
typeID
The data type identifier that represents a signal
The int_T
value 1
for a bus,
0
for a nonbus signal, or -1
for an
invalid typeID
.
Use to determine whether the data type identifier for a signal represents a bus
and whether a bus element of another bus is itself a bus. To obtain the data type
identifier for the bus element, use ssGetBusElementDataType
.
C, C++
static void mdlOutputs(SimStruct *S, int_T tid) { DTypeId dType = ssGetOutputPortDataType(S, 0); const void *u = ssGetInputPortSignal(S, 0); int numElems = ssGetNumBusElements(S, dType); int i; for(i=0; i<numElems; i++) { int_T elemType = ssGetBusElementDataType(S, dType, i); if (ssIsDataTypeABus(S, elemType) == 1) { /* Sub-bus element */ ... } } }