Documentation Center

  • Trial Software
  • Product Updates

ssSetDataTypeSize

Set the size of a custom data type

Syntax

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

Arguments

S

SimStruct representing 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 Custom Data Types for more information on registering custom data types.

The Simulink® Coder™ product does not support S-functions that contain custom data types. Attempting to generate code for a model that contains this macro results in an error.

Languages

C, C++

Example

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;
Was this topic helpful?