Main Content

ssGetStringDataTypeMaxLength

Get maximum length of string data type

Since R2020b

Syntax

size_t ssGetStringDataTypeMaxLength(SimStruct *S,int dataType)

Arguments

S

SimStruct that represents an S-Function block.

dataType

ID of data type.

Returns

  • A value of type size_T, indicating the maximum length of the string.

  • 0, if the string has no maximum length.

Description

ssGetStringDataTypeMaxLength determines the maximum length (size_t) of a string. The string has no maximum length if ssGetStringDataTypeMaxLength is 0.

Limitations

Non-inlined S-functions that contain string SimStruct functions do not run with rapid accelerator mode.

Languages

C, C++

Examples

This example gets the maximum length of a string.

    ...
    {
        if(ssGetStringDataTypeMaxLength(S, ssGetInputPortDataType(S, 0)) == 0)
            ssSetOutputPortDataType(S, 0, ssRegisterStringDataType(S, 0));
        else
            ssSetOutputPortDataType(S, 0, ssRegisterStringDataType(S,
                ssGetStringDataTypeMaxLength(S, ssGetInputPortDataType(S, 0)) + mxGetN(INSSTR)));
    }
...

Version History

Introduced in R2020b