| Contents | Index |
int_T ssGetBusElementDataType(SimStruct* S, int_T busTypeID, int_T elemIdx)
SimStruct that represents an S-Function block
The bus data type identifier that represents the bus signal
The zero-based bus element index
int_T
Use to get the data type identifier for a specific bus element in a bus signal. Use the data type identifier to determine useful aspects of the bus element, including the number of elements (if this bus element is itself a bus signal) or the size of the data (ssGetDataTypeSize).
Use this S-function in simulations. You cannot use this S-function for code generation.
This S-function does not support bus elements that have any of the following characteristics:
Variable dimensions
Frames
Enumerated (enum) data types
To use this S-function and other bus-related S-functions, before you run the simulation, execute the following MATLAB command:
set_param(block_handle, 'EnableBusSupport', 'on')
To automate setting the EnableBusSupport parameter, use one of the following approaches:
Add the command to the model initialization callback.
Mask the S-Function block and add the command to the mask initialization callback
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 (elemType == SS_DOUBLE) {
/* Process signal here */
} else {
...
}
}
}
ssGetDataTypeSize, ssGetNumBusElements

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |