char

Returns a string matrix whose elements are the input arguments, vertically concatenated.

Syntax

R = char(s,...)

Inputs

s
Type: scalar | string | mat | cell

Outputs

R
Type: string | mat

Examples

String inputs:
R = char('This', 'is', 'vertically', 'concatenated')
R =
This
is
vertically
concatenated
Scalar, string, cell array and matrix inputs:
R = char(75, 'char example',  {65, 'Cell element 1', 'Cell element 2'}, [65;66;67], [65,66,67])
R =
K
char example
A
Cell element 1
Cell element 2
A
B
C
ABC

Comments

The elements of the output array are padded with spaces, if needed, to make the length of each row consistent. For input arguments which are finite scalars, the element in the output array will have the equivalent ASCII character. For input arguments which are cell arrays, each element of the cell array forms a new row in the output array.