PRINT
<matrices> <*>(expression) <*>"message" <*>pointer-controls <[options]> ;
The PRINT statement displays the values of matrices or literals.
The arguments to the PRINT statement are as follows:
are the names of matrices.
is an expression in parentheses that is evaluated. The result of the evaluation is printed. The evaluation of a subscripted matrix used as an expression results in printing the submatrix.
is a message in quotes.
control the pointer for printing. For example, a comma (,) skips a single line and a slash (/) skips to a new page.
are described in the following list.
The following options can appear in the PRINT statement. They are specified in brackets after the matrix name to which they apply.
For example, the following statements print a matrix in the 12.2 format with column and row labels:
x = {45.125 50.500, 75.375 90.825}; r = {"Div A" "Div B"}; c = {"Amount" "Net Pay"}; print x[rowname=r colname=c format=12.2];
Figure 23.237: Matrix with Row and Column Labels
x | ||
---|---|---|
Amount | Net Pay | |
Div A | 45.13 | 50.50 |
Div B | 75.38 | 90.83 |
To permanently associate the preceding options with a matrix name, see the description of the MATTRIB statement.
If there is not enough room to print all the matrices across the page, then one or more matrices are printed out in the next group. If there is not enough room to print all the columns of a matrix across the page, then the columns are continued on a subsequent line.
The spacing between adjacent matrices can be controlled by the SPACES= option of the RESET statement. The FW= option of the RESET statement can be used to control the number of print positions used to print each numeric element. For more print-related options, including the PRINTADV option, see the description of the RESET statement.
To print part of a matrix or a temporary expression, enclose the expression in parentheses:
y=1:10; print (y[1:3])[format=5.1]; /* prints first few elements */ print (sum(y))[label="sum"];
Figure 23.238: Printing Temporary Matrices
1.0 |
2.0 |
3.0 |
sum |
---|
55 |
sum |
---|
55 |