IMatrix.ChangeValueFlag

Syntax

ChangeValueFlag(FlagFrom: Integer; FlagTo: Integer);

Parameters

FlagFrom - flag of changed elements, for which it is necessary to assign new value.

FlagTo - new value of changed elements flag.

Description

The ChangeValueFlag method changes the flag that is used to select changed values.

Comments

Use the IMatrix.ValueFlag property to determine flag value.

Example

To execute the example, add links to the MathFin and Matrix system assemblies.

Sub UserProc;
Var
    M: Matrix[2];
    Mm: IMatrix;
    Iter: IMatrixIterator;
    Coord: IMatrixCoord;
    x, y: Integer;
Begin
    For x := 0 To 4 Do
        For y := 0 To 4 Do
            M[x, y] := Math.RandBetweenI(09);
        End For;
    End For;
    Mm := M As IMatrix;
    Debug.WriteLine("Original matrix");
    Iter := Mm.CreateIterator;
    Iter.Move(IteratorDirection.First);
    While Iter.Valid Do
        Debug.WriteLine(Iter.Value + " " + Iter.ValueFlag.ToString);
        Iter.Move(IteratorDirection.Next);
    End While;
    Mm.ValueFlag := 1;
    Coord := Mm.CreateCoord;
    Coord.Item(0) := 0;
    Coord.Item(1) := 0;
    Mm.Item(Coord) := 11;
    Coord.Item(0) := 2;
    Coord.Item(1) := 2;
    Mm.Item(Coord) := 13;
    Mm.ValueFlag := 2;
    Coord.Item(0) := 1;
    Coord.Item(1) := 1;
    Mm.Item(Coord) := 12;
    Coord.Item(0) := 3;
    Coord.Item(1) := 3;
    Mm.Item(Coord) := 14;
    Debug.WriteLine("Before the flag is changed");
    Iter.Move(IteratorDirection.First);
    While Iter.Valid Do
        Debug.WriteLine(Iter.Value + " " + Iter.ValueFlag.ToString);
        Iter.Move(IteratorDirection.Next);
    End While;
    Mm.ChangeValueFlag(110);
    Debug.WriteLine("After the flag is changed");
    Iter := Mm.CreateIterator;
    Iter.Move(IteratorDirection.First);
    While Iter.Valid Do
        Debug.WriteLine(Iter.Value + " " + Iter.ValueFlag.ToString);
        Iter.Move(IteratorDirection.Next);
    End While;
End Sub UserProc;

After executing the example a matrix with random values is created. Values of four diagonal elements are updated in this matrix. Values are changed with different flag. After this, flag value of the elements, that were changed with matrix flag 1, changes to 10. Elements values and their corresponding flags are displayed in the development environment console.

See also:

IMatrix