IMatrixModelSwapInfo.Swap

Syntax

Swap(IndexFrom: Integer; IndexTo: Integer);

Parameters

IndexFrom - index of the dimension, which must be moved.

IndexTo - index of the position, to which the dimension must be moved.

Description

The Swap method rearranges dimensions. For the changes to take effect, the Swap method must be executed.

Example

Sub Main;

Var

M: Matrix[3];

Mm: IMatrixModel;

Swap: IMatrixModelSwapInfo;

x, y, z: Integer;

Begin

Debug.WriteLine("Source matrix");

For x := 1 To 3 Do

For y := 1 To 3 Do

For z := 1 To 3 Do

M[x, y, z] := Math.RandBetweenI(0, 9);

Debug.Write(M[x, y, z] + " ");

End For;

Debug.WriteLine("");

End For;

Debug.WriteLine("");

End For;

Mm := M As IMatrixModel;

Swap := (M As IMatrix).CreateSwapInfo;

Swap.Swap(0, 1);

M := (M As IMatrix).Swap(Swap);

Debug.WriteLine("A matrix with rearranged dimensions");

For x := 1 To 3 Do

For y := 1 To 3 Do

For z := 1 To 3 Do

Debug.Write(M[x, y, z] + " ");

End For;

Debug.WriteLine("");

End For;

Debug.WriteLine("");

End For;

End Sub Main;

After executing the example a matrix containing random values will be created. In this matrix the first and second dimensions will be swapped.

See also:

IMatrixModelSwapInfo