This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Set the zero representation of a data type


int_T ssSetDataTypeZero(SimStruct *S, DTypeId id, void* zero)



SimStruct representing an S-Function block.


ID of the data type.


Zero representation of the data type specified by id.


1 (true) if successful. Otherwise, returns 0 (false) and reports an error.


Sets the zero representation of the data type specified by id to zero if id is valid, the size of the data type has been set, and the zero representation has not already been set. The zero representation of a custom data type is the value that represents zero for that data type. Otherwise, this macro fails and reports an error. Because this macro reports any error that occurs, you do not need to use ssSetErrorStatus to report the error. See Custom Data Types for more information on registering custom data types.

    Note   This macro makes a copy of the zero representation of the data type for the Simulink® engine to use. Thus, your S-function does not have to maintain the original in memory.

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


C, C++


The following example registers and sets the size and zero representation of a custom data type named myDataType.

typedef struct{
	int8_T   a;
	uint16_T b;

int_T    status;
DTypeId  id;
myStruct tmp;      

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

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

tmp.a = 0;
tmp.b = 1;
status = ssSetDataTypeZero(S, id, &tmp);
if(status == 0) return;

Introduced before R2006a

Was this topic helpful?