Concatenate strings horizontally
s = strcat(
horizontally
concatenates s1,...,sN
)s1,...,sN
. Each input argument can
be a character array, a cell array of character vectors, or a string
array.
If any input is a string array, then the result is a string array.
If any input is a cell array, and none are string arrays, then the result is a cell array of character vectors.
If all inputs are character arrays, then the result is a character array.
For character array inputs, strcat
removes
trailing ASCII white-space characters: space, tab, vertical tab, newline,
carriage return, and form feed. For cell and string array inputs, strcat
does
not remove trailing white space.
Character arrays also can be concatenated using left and right square brackets.
s1 = 'Good '; s2 = 'Morning'; s = [s1 s2]
s = Good Morning