ssGetStringDataTypeMaxLength

Get maximum length of string data type

Syntax

size_t ssGetStringDataTypeMaxLength(SimStruct *S,int dataType)

Arguments

S

SimStruct representing 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.

Languages

C, C++

Example

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)));
    }
...
Introduced in R2020b