CreateMatrixModel(DimensionCount: Integer): IMatrixModel;
CreateMatrixModel(DimensionCount: integer): Prognoz.Platform.Interop.ForeSystem.IMatrixModel;
DimensionCount. The number of dimensions in the created matrix.
The CreateMatrixModel method creates a matrix structure.
To ensure correct performance, the DimensionCount parameter must be greater than zero.
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.
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
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";
System.Diagnostics.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
System.Diagnostics.Debug.Write(" " + result.Item[coord]);
Else
System.Diagnostics.Debug.Write(" Null");
End If;
End For;
System.Diagnostics.Debug.WriteLine("");
End For;
End Sub;
Example execution result: a two-dimensional data matrix is created. Matrix data is displayed in the console window.
See also: