| Contents | Index |
S = char(X)
S = char(C)
S = char(T1,T2,...,TN)
S = char(X) converts array X of nonnegative integer codes into a character array. Valid codes range from 0 to 65535, where codes 0 through 127 correspond to 7-bit ASCII characters. The characters that MATLAB can process (other than 7-bit ASCII characters) depend upon your current locale setting. To convert characters into a numeric array, use the double function.
S = char(C), when C is a cell array of strings, places each element of C into the rows of the character array s. Use cellstr to convert back.
S = char(T1,T2,...,TN) forms the character array S containing the text strings T1, T2, ..., TN as rows, automatically padding each string with blanks to form a valid matrix. Each text parameter, Ti, can itself be a character array. This allows the creation of arbitrarily large character arrays. Empty strings are significant.
Create a 3-by-32 array of the printable ASCII characters.
asc = char(reshape(32:127,32,3)')
asc =
!"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
`abcdefghijklmnopqrstuvwxyz{|}~cellstr | get | iscellstr | ischar | isletter | isspace | isstrprop | set | strings | text

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |