Convert to character array
S = char( converts
array A)A into a character array.
If A is a numeric array, then char converts
numbers into characters. Valid numeric values range from 0 to 65535
and correspond to Unicode® code units. Values from 0 to 127 also
correspond to 7-bit ASCII characters.
If A is a character array, then char returns A unaltered.
To convert characters into a numeric array, use a function that
converts to a numeric type (for example, double, int32,
or cast).
Starting in R2016b, if A is a string
array, then char converts the string array into
a character array. char converts each string element
of A into a character vector, and then concatenates
the vectors to produce a character array, automatically padded with
blank spaces as needed. As a result, S has one
more dimension than A.
To convert S to a string array, use the string function.
If A is a cell array of character
arrays, then char converts the cell array into
a character array. Each row from each character array in the cell
array become a row in S, automatically padded with
blank spaces as needed.
To convert S into a cell array of character
vectors, use the cellstr function.
If A is a categorical array, then char converts
each element of A into a row of a character array,
in column order.
S = char(A1,...,AN) converts the arrays A1,...,AN into
a single character array. After conversion to characters, the input
arrays become rows in S. The char function
pads rows with blank spaces as needed. If any input array is an empty
character array, then the corresponding row in S is
a row of blank spaces.
The input arrays A1,...,AN cannot be string
arrays, cell arrays, or categorical arrays.
A1,...,AN can be of different sizes and shapes.
S = char( converts
a datetime, duration, or calendar duration array into a character
array in the format specified by the D)Format property
of D. The output contains one date or duration
in each row.