|MATLAB Function Reference|
Convert to character array (string)
S = char(X)
converts the array
X that contains positive integers representing character codes into a MATLAB character array (the first 127 codes are ASCII). The actual characters displayed depend on the character set encoding for a given font. The result for any elements of
X outside the range from 0 to 65535 is not defined (and can vary from platform to platform). Use
double to convert a character array into its numeric codes.
S = char(C),
C is a cell array of strings, places each element of
C into the rows of the character array
cellstr to convert back.
S = char(t1, t2, t3, ...)
forms the character array
S containing the text strings
... as rows, automatically padding each string with blanks to form a valid matrix. Each text parameter,
i, can itself be a character array. This allows the creation of arbitrarily large character arrays. Empty strings are significant.
Ordinarily, the elements of
A are integers in the range 32:127, which are the printable ASCII characters, or in the range 0:255, which are all 8-bit values. For noninteger values, or values outside the range 0:255, the characters printed are determined by
To print a 3-by-32 display of the printable ASCII characters,
© 1994-2005 The MathWorks, Inc.