Main Content

ssIsDataTypeABus

Determine whether a data type identifier represents a bus

Syntax

int_T ssIsDataTypeABus(S, int_T typeID)

Arguments

S

SimStruct that represents an S-Function block

typeID

The data type identifier that represents a signal

Returns

The int_T value 1 for a bus, 0 for a nonbus signal, or -1 for an invalid typeID.

Description

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.

Languages

C, C++

Examples

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 */
            ...
        }
     }
  }

Version History

Introduced in R2010b