Matrix

Matrix - base class that is used to create a dynamic matrix with data. This class does not have its own methods, properties or constructors. When a variable with the Matrix type is declared, a new matrix is automatically initialized. When a variable is declared, specify the number of dimensions of the new matrix:

Var
    M: Matrix[2];

You can access matrix elements in the same way as the array elements. A matrix supports properties and methods of the IMatrixModel and IMatrixIMatrix interfaces.

Sub UserProc;
Var
    M: Matrix[2];
    Mm: IMatrixModel;
    c: IMatrixModelCoord;
    i, j: Integer;
Begin
    For i := 0 To 5 Do
        For j := 0 To 5 Do
            M[i, j] := Math.RandBetweenI(0100);
            Debug.Write(m[i, j] + " ");
        End For;
        Debug.WriteLine("");
    End For;
    Mm := M As IMatrixModel;
    c := Mm.CreateModelCoord;
    c.Item(0) := 0;
    Mm.Sort(c, True);
    Debug.WriteLine("Sorted  matrix");
    For i := 0 To 5 Do
        For j := 0 To 5 Do
            Debug.Write(M[i, j] + " ");
        End For;
        Debug.WriteLine("");
    End For;
End Sub UserProc;

After executing the example a two-dimensional matrix is created. This matrix is filled with random values and sorted by the values of the first row. The source matrix and the sorted matrix are displayed in the development environment console.

See also:

System Assembly Classes