ssGetNumBusElements
Get the number of elements in a bus signal
Syntax
int_T ssGetNumBusElements(SimStruct *S, int_T busTypeID)
Arguments
-
S
-
SimStruct that represents an S-Function block
-
busTypeID
-
The bus data type identifier that represents the bus signal
Returns
int_T
Description
Use to determine the number of elements in the bus. If one of the elements is also a bus signal, usessGetNumBusElements
recursively to determine the number of elements in the sub-bus signal. The second argument is the identifier that Simulink®returns after you register the bus object that represents the bus signal. (To register a bus object, usessRegisterTypeFromParameter
or an equivalent method.)
Languages
C, C++
Example
静态孔隙mdlOutputs (SimStruct *年代,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