Method Reference: string.append

string: newstr = append (str1, …, strN)

Combine string arrays.

newstr = append (str1, …, strN) combines the text from each input argument, str1, …, strN), which must be either string arrays, cell arrays of character vectors, or character vectors or matrices. All input arguments must be of compatible sizes. Character vectors are treated as a single text element and character matrices are treated as a column of elements. append preserves any trailing white spaces, unlike the strcat function.

Source Code: string

Example: 1

append joins its arguments end to end, element-wise — like strcat, but it keeps trailing whitespace.

 first = string ({'Ann'; 'Bob'})
first =
  2x1 string array

    "Ann"    
    "Bob"
 append (first, ' ', string ({'Lee'; 'Ng'}))
ans =
  2x1 string array

    "Ann Lee"    
    "Bob Ng"