Main Content

ssSetDataTypeSize

Set the size of a custom data type

Syntax

int_T ssSetDataTypeSize(SimStruct *S, DTypeId id, int_T size)

Arguments

S

SimStruct that represents an S-Function block.

id

ID of the data type.

size

Size of the custom data type in bytes.

Returns

1 (true) if successful. Otherwise, returns 0 (false).

Description

Sets the size of the data type specified by id to size. Use this macro in mdlInitializeSizes to set the size of a data type you have registered. See Configure Custom Data Types for more information on registering custom data types.

For more information about using custom data types in S-functions, see Configure Custom Data Types.

Languages

C, C++

Examples

The following example registers and sets the size of the custom data type named Color to 4 bytes.

int_T   status;
DTypeId id;

id = ssRegisterDataType(S, "Color");
if(id == INVALID_DTYPE_ID) return;

status = ssSetDataTypeSize(S, id, 4);
if(status == 0) return;

Version History

Introduced before R2006a