mat reorder Example

10    OPTION BASE 1
20    DIM Matrix(3,3),Vector(3)
30    DATA 1, 2, 3, 4, 5, 6, 7, 8, 9, 3, 2, 1
40    RESTORE
50    READ Matrix(*),Vector(*)
60    CLEAR SCREEN
70    PRINT "The matrix looks like: "
80    Prtmat(Matrix(*),3,3)
90    MAT REORDER Matrix BY Vector,2
100   PRINT "MAT reorder"
110   Prtmat(Matrix(*),3,3)
120   END
130   SUB Prtmat(A(*),Lenarr,Widarr)
140! This sub prints out a matrix length of Lenarr and wide as widarr.
150! A 3x3 matrix would print like:
160!           [ 1 2 3 ]  Widarr = 3
170!           [ 4 5 6 ]
180!           [ 7 8 9 ]
190!           Lenarr = 3
200     ASSIGN @Out TO CRT
210     FOR Col=1 TO Lenarr
220       OUTPUT @Out;"  [";
230       FOR Row=1 TO Widarr
240         OUTPUT @Out;A(Col,Row);
250       NEXT Row
260       OUTPUT @Out;" ]"
270     NEXT Col
280     ASSIGN @Out TO *
290   SUBEND