Main Content

String Constant

Output specified string

  • String Constant block

Libraries:
Simulink / String

Description

The String Constant block outputs a string specified by the String parameter. Use this block when you want a constant whose type is string.

Limitations

The Output data type parameter does not support string data types that use symbolic expressions to specify the maximum length because signals with symbolic dimensions must be driven by a block with nonconstant sample time. For example, the Output data type parameter specified as stringtype("N") with N defined as a symbolic expression is not supported.

Ports

Output

expand all

Output string, specified as a scalar.

Data Types: string

Parameters

expand all

Input string, specified as a scalar.

Programmatic Use

Block Parameter: String
Type: character vector
Values: '"Hello!"' | scalar
Default: '"Hello!"'

Output data type, specified using the string data type to specify a string with no maximum length.

To specify a string data type with a maximum length, specify stringtype(N). For example, stringtype(31) creates a string data type with a maximum length of 31 characters.

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. See Specify Data Types Using Data Type Assistant for more information.

Programmatic Use

Block Parameter: OutDataTypeStr
Type: character vector
Values: 'string' | <data type expression>
Default: 'string'

Use the stringtype function, for example, stringtype(31).

Dependency

Clicking the Show data type assistant button enables this parameter.

Block Characteristics

Data Types

string

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2018a