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
Input string signal, specified as a scalar.
Data Types: string
Output
Enumerated number associated with the input string, specified as a scalar.
Data Types: enumerated
Parameters
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
.
Enumerated
— Enumerated data class object.<data type expression>
— Expressions that evaluate to data types. SelectingExpression
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
Version History
Introduced in R2018a
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.