Method Reference: string.strlength

string: out = strlength (str)

Length of text in string arrays.

Source Code: string

Example: 1

strlength returns the number of characters in each string (contrast length/numel, which count the array's elements).

 s = string ({'a'; 'four'; 'twelve chars'})
s =
  3x1 string array

    "a"               
    "four"            
    "twelve chars"
 strlength (s)
ans =

    1
    4
   12