| Contents | Index |
void ssRegisterTypeFromParameter(SimStruct *S, int_T paramIndex, int_T * dataTypeIndex)
SimStruct that represents an S-function block
The zero-based index of the S-function parameter that specifies the bus object name
dataTypeIndex, which is a pointer to an int_T that contains the Simulink ID of the newly registered data type
Use in mdlInitializeSizes to register a bus object that a Block Parameters dialog box specifies as a valid data type in the Simulink data type table. To set the data type, use ssRegisterTypeFromParameter in combination with ssSetInputPortDataType and ssSetOutputPortDataType.
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 mdlInitializeSizes(SimStruct *S)
{
/* Compile-time handling */
if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY) {
int id;
/* Register bus object data type (passed in as the
* first parameter in the block dialog
*/
ssRegisterTypeFromParameter(S, 0, &id);
/* Set the bus data type identifier for the input
* and output port data type of the block.
*/
ssSetInputPortDataType(S, 0, id);
ssSetOutputPortDataType(S, 0, id);
}
}
ssSetInputPortDataType, ssSetOutputPortDataType

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 |