Main Content

strlength

Length of string

Description

example

L = strlength(str) returns the number of characters in str.

Note

The operator strlength is supported only in Stateflow® charts that use MATLAB® as the action language.

Examples

expand all

Return the length of the string.

h = "Hello, world!"
x = strlength(h)

Stateflow chart that uses the string operator in a state.

Result of the string operator

Introduced in R2021b