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
If there is a non-printable character in s, it will be substituted by ' ' (whitespace character) when R is displayed.
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
Non-printable characters in the input:
R = char([65 0 66])
R = A B

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.