IMatrixModelFactory.CreateMatrixModel

Syntax

CreateMatrixModel(DimensionCount: Integer): IMatrixModel;

Parameters

DimensionCount. The number of dimensions in the created matrix.

Description

The CreateMatrixModel method creates a matrix structure.

Comments

To ensure correct performance, the DimensionCount parameter must be greater than zero.

Example

To execute the example, add a link to the Fore assembly.

Sub UserProc;
Var
    result: IMatrixModel;
    factory: IMatrixModelFactory;
    coord: IMatrixModelCoord;
    i, j: Integer;
Begin
    factory := New MatrixFactory.Create;
    result := factory.CreateMatrixModel(2);
    coord := result.CreateModelCoord;
    coord.Item(0) := 0;
    coord.Item(1) := 0;
    result.Item(coord) := "a";
    coord.Item(0) := 0;
    coord.Item(1) := 1;
    result.Item(coord) := "b";
    coord.Item(0) := 0;
    coord.Item(1) := 2;
    result.Item(coord) := "c";
    coord.Item(0) := 1;
    coord.Item(1) := 1;
    result.Item(coord) := "d";
    Debug.WriteLine("Obtained matrix");
    For i := 0 To 1 Do
        For j := 0 To 2 Do
            coord.Item(0) := i;
            coord.Item(1) := j;
            If result.Item(coord) <> Null Then
                Debug.Write("    " + result.Item(coord));
            Else
                Debug.Write(" Null");
            End If;
        End For;
        Debug.WriteLine("");
    End For;
End Sub UserProc;

Example execution result: a two-dimensional data matrix is created. Matrix data is displayed in the console window.

See also:

IMatrixModelFactory