MatrixInt.SetVal Method

Overload List

#SignatureDescription
1function SetVal(const Value: Integer): TMtxInt;Set all calling object elements to Value.
└ indexed: function SetVal(const Value: Integer; const Index: Integer; const Len: Integer): TMtxVecInt;
2function SetVal(const Value: Integer; Row: Integer; Col: Integer; ToRow: Integer; ToCol: Integer): TMtxInt;Initializes matrix values to Value.

Overload 1: function SetVal(const Value: Integer): TMtxInt;

Set all calling object elements to Value.

#NameTypeDescription
1ValueInteger

Result: stored in self (calling object), returns self for chaining

Indexed: function SetVal(const Value: Integer; const Index: Integer; const Len: Integer): TMtxVecInt;

Set calling object elements [Index]..[Index+Len-1] to Value.

#NameTypeDescription
1ValueInteger
2IndexIntegerstart index
3LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

An exception is raised if array borders are overrun/underrun.

Examples
Uses MtxExprInt;

procedure Example;
var a:MatrixInt;
begin
    a := [[1,2],[3,4]];
    a.SetVal(5,2,2); // a = [1,1,5,5]
end;

Overload 2: function SetVal(const Value: Integer; Row: Integer; Col: Integer; ToRow: Integer; ToCol: Integer): TMtxInt;

Initializes matrix values to Value.

#NameTypeDescription
1ValueInteger
2RowInteger
3ColInteger
4ToRowInteger
5ToColInteger

Result: stored in self (calling object), returns self for chaining

Remarks:

Sets the calling matrix elements [Row,Col]..[ToRow,ToCol] to Value. An exception is raised if TMtxVecBase.ConditionCheck is true and array bounds are overrun.

See Also: MatrixInt.SetIt, MatrixInt.SetZero