Method Reference: string.cellstr

string: cstr = cellstr (str)

Convert string array to a cell array of character vectors.

cstr = cellstr (str) returns a cell array of character vectors, cstr, which has the same size as the input string str. Both empty strings and missing values are returned as empty character vectors.

Source Code: string

Example: 1

cellstr converts a string array into a cell array of character vectors — the inverse of building a string from a cellstr.

 s = string ({'apple'; 'banana'})
s =
  2x1 string array

    "apple"     
    "banana"
 cellstr (s)
ans =
  2x1 cell array

    {'apple' }    
    {'banana'}