The MAT statement lets you implicitly create and manipulate one- and two-dimensional arrays. You can use the MAT statement to assign values to array elements, or to redimension a previously dimensioned array. You can also perform matrix arithmetic operations such as multiplication, addition, and subtraction, and other matrix operations such as transposing and inverting matrices. Examples: MAT First_array = ZER MAT String_array = NUL$ MAT A = B + C MAT C = (55.2) * First_array
1 – Syntax
Initialization (Numeric):
{ CON }
MAT num-array = { IDN } [ ( int-exp1 [, int-exp2 ] ) ]
{ ZER }
Initialization (String):
MAT str-array = NUL$ [ ( int-exp1 [, int-exp2 ] ) ]
Array Arithmetic:
[ { + } ]
MAT num-array1 = num-array2 [ { - } num-array3 ]
[ { * } ]
MAT num-array1 = num-array2 * num-array3 [* num-array4] ,...
Scalar Multiplication:
MAT num-array4 = ( num-exp ) * num-array5
Inversion and Transposition:
{ TRN }
MAT num-array6 = { INV } ( num-array7 )
2 – INPUT
The MAT INPUT statement assigns values from a terminal or terminal-format file to array elements. Example MAT INPUT Emp_name$(10,10)
2.1 – Syntax
MAT INPUT [ chnl-exp, ] { array [ (int-exp1 [,int-exp2]) ] },...
3 – LINPUT
The MAT LINPUT statement receives string data from a terminal or terminal-format file and assigns it to string array elements. Example MAT LINPUT Time_card$(10%)
3.1 – Syntax
MAT LINPUT [chnl-exp,] { str-array [ (int-exp1 [,int-exp2]) ]
},...
4 – PRINT
The MAT PRINT statement prints the contents of a one- or two-dimensional array on your terminal or assigns the value of each array element to a record in a terminal-format file. Example MAT PRINT Arr1(5,5)
4.1 – Syntax
MAT PRINT [chnl-exp,] {array [(int-exp1 [,int-exp2])] [{ , }]}...
{ ; }
5 – READ
The MAT READ statement assigns values from DATA statements to array elements. Example MAT READ Animal$(2,2) DATA CAT,DOG,GOAT,RABBIT
5.1 – Syntax
MAT READ { array [ ( int-exp1 [, int-exp2 ] ) ] },...