CHAR Function |
The CHAR function produces a character representation of a numeric matrix. Essentially, the CHAR function is equivalent to applying a w.d format to each element of a numeric matrix.
The arguments to the CHAR function are as follows:
is a numeric matrix or literal.
is the field width.
is the number of decimal positions.
The CHAR function takes a numeric matrix as an argument and, optionally, a field width and a number of decimal positions . The CHAR function produces a character matrix with the same dimensions as the argument matrix, and with elements that are character representations of the corresponding numeric elements.
If the w argument is not supplied, the system default field width is used. If the d argument is not supplied, the best representation is used. See also the description of the NUM function, which converts a character matrix into a numeric matrix.
For example, the following statements produce the output shown in Figure 23.58:
a = {-1.1 0 3.1415 4}; reset print; /* display values and type of matrices */ m = char(a, 4, 1);
m 1 row 4 cols (character, size 4) |
-1.1 | 0.0 | 3.1 | 4.0 |