Method Reference: string.char

string: c_mat = char (str)

Convert string array to a character matrix.

c_mat = char (str) returns a character matrix, c_mat, which contains as many rows as the elements of the string. Both empty strings and missing values are returned as empty character vectors.

Source Code: string

Example: 1

char converts a string array to a plain character matrix, one row per element (shorter rows padded with spaces).

 s = string ({'small'; 'medium'})
s =
  2x1 string array

    "small"     
    "medium"
 char (s)
ans =

small 
medium