Main Content

ssRegisterTypeFromParameter

Register a data type that a parameter in the Simulink data type table specifies

Syntax

void ssRegisterTypeFromParameter(SimStruct *S, int_T paramIndex, int_T * dataTypeIndex)

Arguments

S

SimStruct that represents an S-function block

paramIndex

The zero-based index of the S-function parameter that specifies the bus object name

Returns

dataTypeIndex, which is a pointer to an int_T that contains the Simulink® ID of the newly registered data type

Description

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.

Languages

C, C++

Examples

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);
    }
 }

Version History

Introduced in R2010a