Formatted Printing Options for Arrays, Matrices, and Vectors
|
Description
|
|
•
|
The printf, fprintf, sprintf, and nprintf family of formatted printing functions (hereinafter referred to only as printf), can be used to print objects of type Array, Matrix, and Vector, collectively known as rtables.
|
•
|
Formatting specifications for printf are introduced by the "%" character, followed by zero or more flags, an optional width and precision, optional modifiers, and a one-letter formatting code. One of the possible flags is a sequence of rtable formatting options enclosed in braces "{}".
|
•
|
The rtable formatting options are specified as a sequence of characters within the enclosing braces. The available options are:
|
|
Data is to be transposed when writing. In other words, for the dense printing format, each column of the rtable is written as a row. In general, it is as though the rtable were transposed before printing, except that no actual transposed copy of the rtable is made.
|
|
If the rtable uses band, upper triangular, or lower triangular storage, write only the explicitly stored elements. So for a band Matrix, the first and last few rows written will have fewer elements than most of the rows. For an upper triangular rtable, each row will be one shorter than the one before it. For a lower triangular rtable, each row will be one longer than the one before it.
|
|
If the rtable uses band storage, write only the bands, one per row, starting with the sub-diagonals if b- was specified, or the super-diagonals if b+ was specified.
|
|
Write each element as a row, giving a set of indices followed by a value. Only explicitly stored elements are written.
|
|
Write the data as a set of vectors, the first of which give the indices (one index per vector), and the last one of which gives the values. Only indices and values for explicitly stored elements are written.
|
|
Suppress the separator between elements printed on the same line. This is useful when the basic display format has already been chosen to include separator space.
|
|
Suppress the line break between rows of elements.
|
|
Use the character specified by a as the separator between output items. This option is ignored if s is also specified. A comma (",") separator, in conjunction with the %v" or %V formats, will produce output in Standard or Microsoft "Comma Separated Values" formats respectively.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
0 0 0 0
0 69 0 0
-4 -2 -93 0
0 0 -18 0
| |
>
|
|
0 0 0 0
0 69 0 0
-4 -2 -93 0
0 0 -18 0
| |
>
|
|
0
0 69
-4 -2 -93
0 0 -18 0
| |
>
|
|
0 0 -4 0
0 69 -2 0
0 0 -93 -18
0 0 0 0
| |
>
|
|
0,0,-4,0
0,69,-2,0
0,0,-93,-18
0,0,0,0
| |
>
|
|
0,0,0,0,0,69,0,0,-4,-2,-93,0,0,0,-18,0
| |
>
|
|
1 2 2 3 3 3 4 4 4 4
1 1 2 1 2 3 1 2 3 4
0 0 69 -4 -2 -93 0 0 -18 0
| |
>
|
|
1 1 0
2 1 0
2 2 69
3 1 -4
3 2 -2
3 3 -93
4 1 0
4 2 0
4 3 -18
4 4 0
| |
Non-numeric values are appropriately quoted and/or escaped when printed with the %v or %V formats.
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
0,0,0,0
0,"a+b",0,0
-4,-2,"with \"quotes\"",0
0,0,-18,0
| |
>
|
|
0,0,0,0
0,"a+b",0,0
-4,-2,"with ""quotes""",0
0,0,-18,0
| |
Print a vector as text on a plot.
>
|
|
| (4) |
>
|
|
>
|
|
|
|