Hi Everyone,
I writen a procedure which content two-dimensional dynamic array and I tried to call the procedure in another procedure. But it shows, types of actual and formal var parameters must be identical.
Here is the sample coding,
Type
MatrixArray:array of array of double;
procedure TForm1.Generation(var Source:MatrixArray; var Nsource:integer);
begin
Nsource:=1000;
SetLength(Source, Nsource, 4);
for i:=0 to Nsource-1 do
begin
X:=random;
Y:=random;
Z:=0;
L:=1;
begin
Source[i,0]:=X;
Source[i,1]:=Y;
Source[i,2]:=Z;
Source[i,3]:=L;
end;
end;
end;
procedure TForm1.CalculateClick(Sender: TObject);
var
source:array of array of double;
Nsource:integer;
begin
Generation(source,Nsource); -->Error occurs here
for i:=0 to Nsource-1 do
begin
XL:=Source[i,0]+1;
YL:=Source[i,1]+1;
ZL:=Source[i,2]+1;
LL:=Source[i,3]+1;
Series1.AddXY(XL,YL);
end;
end;
end.
Thank you all for your help.
Vincent
I writen a procedure which content two-dimensional dynamic array and I tried to call the procedure in another procedure. But it shows, types of actual and formal var parameters must be identical.
Here is the sample coding,
Type
MatrixArray:array of array of double;
procedure TForm1.Generation(var Source:MatrixArray; var Nsource:integer);
begin
Nsource:=1000;
SetLength(Source, Nsource, 4);
for i:=0 to Nsource-1 do
begin
X:=random;
Y:=random;
Z:=0;
L:=1;
begin
Source[i,0]:=X;
Source[i,1]:=Y;
Source[i,2]:=Z;
Source[i,3]:=L;
end;
end;
end;
procedure TForm1.CalculateClick(Sender: TObject);
var
source:array of array of double;
Nsource:integer;
begin
Generation(source,Nsource); -->Error occurs here
for i:=0 to Nsource-1 do
begin
XL:=Source[i,0]+1;
YL:=Source[i,1]+1;
ZL:=Source[i,2]+1;
LL:=Source[i,3]+1;
Series1.AddXY(XL,YL);
end;
end;
end.
Thank you all for your help.
Vincent