Main Content

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。

Returns

  • A value of typesize_T, indicating the maximum length of the string.

  • 0, if the string has no maximum length.

Description

ssGetStringDataTypeMaxLengthdetermines the maximum length (size_t) of a string. The string has no maximum length ifssGetStringDataTypeMaxLengthis0.

Limitations

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

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

Version History

介绍了R2020b