Main Content

stringtype

Create string data type

Description

example

string = stringtype(maximum_length) creates a Simulink® string data type with a maximum length. Alternatively, you can also create string data types using the String Constant, String Concatenate, and Compose String blocks.

stringtype(maximum_length) creates a Simulink string data type with a maximum length that you can type directly on the MATLAB® command line or in the Output data type parameter of the String Constant, String Concatenate, or Compose String block.

Tip

Specifying stringtype(0) creates a string data type with no maximum length. This syntax is the same as specifying string for Simulink block data types.

Examples

collapse all

Create a string data type of maximum length 10.

h=stringtype(10)
h = 

  StringType with properties:

    MaximumLength: 10
      Description: ''
        DataScope: 'Auto'
       HeaderFile: ''

Input Arguments

collapse all

Maximum length of string data type, specified as a scalar, from 1 to 32766. This value can be an integer, MATLAB variable, or MATLAB expression.

Data Types: double

Output Arguments

collapse all

String object, specified as a scalar.

Version History

Introduced in R2018a