String to Enum - Input string signal to enumerated signal - Simulink (original) (raw)

Main Content

Input string signal to enumerated signal

Libraries:
Simulink / String

Description

The String To Enum block converts the input string signal to an enumerated signal. To use this block, create an enumeration class in the current folder and use that class name in the Output data type parameter.

The String to Enum block generates efficient code for enumerations by generating a shared function for each enumeration type. For more information on enumerations, see Simulink Enumerations.

Ports

Input

expand all

Input string signal, specified as a scalar.

Data Types: string

Output

expand all

Enumerated number associated with the input string, specified as a scalar.

Data Types: enumerated

Parameters

expand all

Use a data type object, for example,Simulink.IntEnumType.

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

Programmatic Use

Block Parameter: OutDataTypeStr
Type: character vector
Values: 'Enum: SlDemoSign' |
Default: 'Enum: SlDemoSign'

Use a data type object, for example,Simulink.IntEnumType.

Dependency

Clicking the Show data type assistant button enables this parameter.

Block Characteristics

Data Types enumerated | string
Direct Feedthrough yes
Multidimensional Signals no
Variable-Size Signals no
Zero-Crossing Detection no

Extended Capabilities

Version History

Introduced in R2018a

expand all

The String to Enum block now generates more efficient code for enumerations by generating a shared function for each enumeration type. Prior to R2025a, this block generated inlined code for enumerations.