This is an experimental feature that may change in future versions.
It is provided for compatibility with other dialects of BASIC and to enhance the code readibility of the Z80 version.

The MAT PRINT statement PRINTs the contents of an array. You can PRINT arrays of any number of dimensions, size or shape. Numeric and string arrays are supported. Array elements are formatted according to the value of the print formatting variable @%.

 10 REM Dimension and populate a sample 2x3 matrix:
 20 DIM a%(1,2)
 30 a%(0,0)=1:a%(0,1)=2:a%(0,2)=3
 40 a%(1,0)=4:a%(1,1)=5:a%(1,2)=6
 50 REM Create a transposed version of the above matrix:
 60 DIM b%(2,1)
 70 MAT b%()=TRN(a%())
 80 REM Print both matrices:
 90 @%=&902
100 MAT PRINT a%(),b%()

Produces the following output:

 1 2 3
 4 5 6

 1 4
 2 5
 3 6

Single-dimensional arrays are printed on a single line. Two-dimensional arrays are printed in a grid. Arrays with more than two dimensions are printed as a sequence of two-dimensional arrays.


MAT PRINT <array-var>[()] [, <array-var>[()] [, ...]]

Associated Keywords