str2ascii

Convert string to array of type uint8

Description

example

A = str2ascii(str,n) returns array of type uint8 containing ASCII values for the first n characters in str, where n is a positive integer.

Use of variables or expressions for n is not supported.

Examples

expand all

Return uint8 array {-72,101,108,108,111}.

A = str2ascii("Hello",5);

Tips

  • Use in Stateflow® charts that use C as the action language.

  • Enclose literal strings with single or double quotes.

Introduced in R2018a