strcat

Concatenates inputs s, ... and returns the result, R, which is of type string or cell array.

Syntax

R = strcat (s, ...)

Inputs

s, ...
For cell array inputs, the sizes need to match.
Type: scalar | string | mat | cell

Outputs

R
Type: string | mat

Examples

String inputs:
R = strcat('These', 'are', 'concatenated', '      (with spaces)', 'strings.')
R = Theseareconcatenated      (with spaces)strings.
Finite, scalar inputs:
strcat(69, 88, 65, 77, 80, 76, 69)
R = EXAMPLE
Matrix inputs:
R = strcat(['S','t'], ['r'; 'i'; 'n'; 'g'])
R =
Str
Sti
Stn
Stg
Cell array inputs:
R = strcat({'string1cell1 ', 'string2cell1 '}, {'string1cell2 ', 'string2cell2 '})
R =
{
[1,1] string1cell1 string1cell2
[1,2] string2cell1 string2cell2
}

Comments

Valid types for inputs are finite scalars, strings, matrices and cell arrays. For inputs which are finite scalars, the element in the result, R, will have the equivalent ASCII character. For inputs which are cell arrays, their sizes need to be the same.

If the input string has trailing whitespaces, they are eliminated before the concatenation. On the other hand, leading whitespaces are preserved.