Main Content

String to Enum

Input string signal to enumerated signal

  • String to Enum block

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.

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. See Specify Data Types Using Data Type Assistant for more information.

Programmatic Use

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

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

  • Enumerated — Enumerated data class object.

  • <data type expression> — Expressions that evaluate to data types. Selecting Expression enables a second menu/text box to the right, where you can enter the expression.

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

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

Version History

Introduced in R2018a