This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

String to ASCII

Convert string signal to uint8 vector

  • Library:
  • 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

Maximum length of output string, specified as a scalar.

Block Characteristics

Data Types

base integer | 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™.

Introduced in R2018a