Main Content

Add numbers, append strings

`C = `

adds
arrays `A`

+ `B`

`A`

and `B`

by adding corresponding
elements. If one input is a string array, then `plus`

appends the
corresponding elements as strings.

The sizes of `A`

and `B`

must be the same or be
compatible. If the sizes of
`A`

and `B`

are compatible, then the two
arrays implicitly expand to match each other. For example, if one of
`A`

or `B`

is a scalar, then the scalar is
combined with each element of the other array. Also, vectors with different
orientations (one row vector and one column vector) implicitly expand to form a
matrix.

For appending text,

`plus`

only operates on string arrays. Use the`append`

function to append text in character vectors or cell arrays.