HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

4-: 83
The following shows an example of printing an array with MAT PRINT.
>list
! mprtexam
5 OPTION BASE 1
10 DIM A(2,2)
20 A(1,1)=0
21 A(1,2)=0
22 A(2,1)=0
23 A(2,2)=0
30 MAT INPUT A
40 MAT PRINT A
>run
?1,2,3,4
1 2
3 4
MAT READ
The MAT READ statement assigns values from one or more DATA statements or
a data file to one or more arrays. If new dimensions are specified for
the arrays, the MAT READ statement redimensions them before assigning
values to them. It assigns values element by element, varying the
rightmost subscript fastest. The MAT READ statement cannot take input
from the terminal keyboard.
Syntax
MAT READ [
#fnum
[,
rnum
[,
wnum
]];]
array
[
dims
][,
array
[
dims
]]...
Parameters
fnum
File number of a data file. If this parameter is
specified, the MAT READ statement reads from a data
file. If it not specified, the MAT READ statement reads
from DATA statements. A program line can read from a
DATA statement or a file, and a command can only read
from a file. For more information on
fnum
, see "File
Identification," in chapter 6.
rnum
Record number. If this parameter is specified, the
statement performs a direct read on the data file
specified by
fnum
. For more information on
rnum
and
direct reads, see "File Input and Output," in chapter 6.
wnum
Word number. If this parameter is specified, the
statement performs a direct word read on the file
specified by
fnum
. That file must be a BASIC DATA file.
For more information on
rnum
and direct word reads, see
"File Input and Output," in chapter 6.
array
Structured collection of variables of the same type.
The structure is determined when the array is declared.
String variables names are suffixed with a "$".
dims
Array dimensions used in syntax specification
statements. Its syntax is
(
dim1
[,
dim2
[,
dim3
[,
dim4
[,
dim5
[,
dim6
]]]]])
where
dim1
through
dim6
each have the syntax
[
num_expr1
:]
num_expr2
and
num_expr1
and
num_expr2
are the lower and upper
bounds (respectively) of the dimension. If
num_expr1
is
not specified, it is the default lower bound.