Assigning Values To An Entire Array At Once - IBM 5110 Basic Introduction

Table of Contents

Advertisement

("."
c'
These statements tell the system to read in values for the
entire
array.
The letters MAT stand for the word matrix.
This method of assigning values with a MAT READ statement has no
effect on your DATA statements. Thus, to assign the temperature data
to one-dimensional array T, you could write these statements:
0020 MAT READ T
0030 DATA 28,31,35,49,60,64,75,81,71,59,46,37
If you use a MAT READ W statement, you would have to enter the
data for the entire array in DATA statements. You assign the data row
by row with these statements:
0020 MAT READ W
0030 DATA 1,28,3.47
0040 DATA 2,31,2.10
0050 DATA 3,35,2.95
or with these statements:
0020 MAT READ W
0030 DATA 1,28,3.47,2,31,2.10,3,35,2.95
If you use a MAT INPUT statement to assign values to an array, the
system will signal you with a flashing question mark, as usual, when it
is ready for you to enter data from the keyboard. If you are supplying
values for a one-dimensional array, just type in all the values on a
single line. If you are supplying values for a two-dimensional array,
type in all the data row by row. Remember that the values must be
separated by commas.
Assigning Values to an Entire Array at Once
If you want every element of an array to have the same value, such as
all l' s or all 0' s, you can assign that value to each element of the array
with the following statement:
0030 MAT A=(O)
You could also assign to every element of an array the value of a
variable or the value of an arithmetic expression with this statement:
0050 MAT T =(X)
or this statement:
0060 MAT M=(X+Y*Z)
Arrays
101
("."
c'
These statements tell the system to read in values for the
entire
array.
The letters MAT stand for the word matrix.
This method of assigning values with a MAT READ statement has no
effect on your DATA statements. Thus, to assign the temperature data
to one-dimensional array T, you could write these statements:
0020 MAT READ T
0030 DATA 28,31,35,49,60,64,75,81,71,59,46,37
If you use a MAT READ W statement, you would have to enter the
data for the entire array in DATA statements. You assign the data row
by row with these statements:
0020 MAT READ W
0030 DATA 1,28,3.47
0040 DATA 2,31,2.10
0050 DATA 3,35,2.95
or with these statements:
0020 MAT READ W
0030 DATA 1,28,3.47,2,31,2.10,3,35,2.95
If you use a MAT INPUT statement to assign values to an array, the
system will signal you with a flashing question mark, as usual, when it
is ready for you to enter data from the keyboard. If you are supplying
values for a one-dimensional array, just type in all the values on a
single line. If you are supplying values for a two-dimensional array,
type in all the data row by row. Remember that the values must be
separated by commas.
Assigning Values to an Entire Array at Once
If you want every element of an array to have the same value, such as
all l' s or all 0' s, you can assign that value to each element of the array
with the following statement:
0030 MAT A=(O)
You could also assign to every element of an array the value of a
variable or the value of an arithmetic expression with this statement:
0050 MAT T =(X)
or this statement:
0060 MAT M=(X+Y*Z)
Arrays
101

Advertisement

Table of Contents
loading

Table of Contents