append

Joins text from several inputs end to end.

Category: Language Fundamentals > Data Types

Syntax

s = append(str1, ..., strN)

Concatenates the inputs in order.

Description

With string arrays the join is element by element, and a scalar is repeated against every element, so append("x", ["1" "2"]) gives "x1" and "x2". A missing string in any input makes that result element missing.

Input arguments

str1, ..., strN
Strings, character vectors or arrays of them. Sizes must be compatible, or scalar.

Output arguments

s
A string array when any input is a string, otherwise a character vector.

Example

Join text

append("ab", "cd")
append('a', 'b', 'c')
append("x", ["1" "2"])
Output
ans = "abcd"
ans = 'abc'
ans = 1×2 string array

    "x1"    "x2"

Notes

In MatLivre, cell array inputs are not accepted.

See also

strcat join plus string strjoin