Main Content

ssRegisterTypeFromNamedObject

Register a custom data type from a Simulink.AliasType, Simulink.NumericType, or Simulink.Bus object.

Syntax

void ssRegisterTypeFromNamedObject(SimStruct *S, char *name, int* id)

Arguments

S

SimStruct that represents an S-Function block.

name

Name of the Simulink® object to assign to the custom data type.

id

An integer whose value is the numeric data type identifier after the call to ssRegisterTypeFromNamedObject.

Description

Use in mdlInitializeSizes, to register a custom data type from a Simulink.AliasType, Simulink.NumericType, or Simulink.Bus object named name.

If the registration was successful, you can declare S-function parameters, DWork vectors, or input and output ports to be of this data type, using the corresponding numeric data type identifier id. If the registration was not successful, id is set to INVALID_DTYPE_ID.

Note

You may not register a custom data type from a Simulink.NumericType object with unspecified scaling.

Languages

C, C++

Examples

The following example registers a custom data type from the Simulink.Numeric type named mydouble. It then specifies that a DWork vector and the first output port be of this data type.

int dtype;
char *name = "mydouble";
ssRegisterTypeFromNamedObject(S, name, &dtype);
ssSetDWorkDataType(S, 0, dtype);
ssSetOutputPortDataType(S, 0, dtype);

Version History

Introduced in R2007b