Main Content

String to ASCII

Convert string signal to uint8 vector

  • String to ASCII block

Libraries:
Simulink / String

Description

The String To ASCII block converts a string signal to a uint8 vector. The block converts each character in the string to its corresponding ASCII value. For example, the block converts the input string "Hello" to [72 101 108 108 111].

Ports

Input

expand all

Input string signal, specified as a scalar.

Data Types: string

Output

expand all

Converted uint8 vector signal of ASCII characters from input string signal, specified as a vector. The block converts each element in the string into its ASCII character equivalent and outputs the ASCII equivalents as a vector. If there are fewer characters than the maximum length, the block fills the remaining space with zeros at simulation. At code generation, the block fills the remaining space with null characters.

Data Types: uint8

Parameters

expand all

Size of output string vector, specified as a scalar.

Programmatic Use

Block Parameter: OutputVectorSize
Type: character vector
Values: scalar
Default: '31'

Block Characteristics

Data Types

integer | 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

expand all