You've already forked lazarus-ccr
LazStats: fix array dimensioning in XvsMultYUnit
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7629 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -82,7 +82,8 @@ uses
|
|||||||
{ TXvsMultYForm }
|
{ TXvsMultYForm }
|
||||||
|
|
||||||
procedure TXvsMultYForm.ResetBtnClick(Sender: TObject);
|
procedure TXvsMultYForm.ResetBtnClick(Sender: TObject);
|
||||||
VAR i : integer;
|
var
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
VarList.Clear;
|
VarList.Clear;
|
||||||
YBox.Clear;
|
YBox.Clear;
|
||||||
@ -173,11 +174,11 @@ begin
|
|||||||
try
|
try
|
||||||
SetLength(YValues, NoY, NoCases);
|
SetLength(YValues, NoY, NoCases);
|
||||||
SetLength(XValues, NoCases);
|
SetLength(XValues, NoCases);
|
||||||
SetLength(Means, NoSelected+1);
|
SetLength(Means, NoSelected);
|
||||||
SetLength(Variances, NoSelected+1);
|
SetLength(Variances, NoSelected);
|
||||||
SetLength(StdDevs, NoSelected+1);
|
SetLength(StdDevs, NoSelected);
|
||||||
SetLength(RMatrix, NoSelected+1, NoSelected+1);
|
SetLength(RMatrix, NoSelected+1, NoSelected+1);
|
||||||
SetLength(selected, NoVariables);
|
SetLength(selected, NoVariables+1);
|
||||||
|
|
||||||
for i := 0 to NoSelected - 1 do
|
for i := 0 to NoSelected - 1 do
|
||||||
begin
|
begin
|
||||||
@ -187,18 +188,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
N := 0;
|
N := 0;
|
||||||
for i := 1 to NoCases do
|
// index rule: array index: i, grid-related index: i+1
|
||||||
|
for i := 0 to NoCases-1 do
|
||||||
begin
|
begin
|
||||||
if not GoodRecord(i, NoSelected, selected) then continue;
|
if not GoodRecord(i+1, NoSelected, selected) then continue;
|
||||||
inc(N);
|
inc(N);
|
||||||
XValues[i-1] := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[XCol,i]));
|
XValues[i] := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[XCol, i+1]));
|
||||||
MaxX := Max(MaxX, XValues[i-1]);
|
MaxX := Max(MaxX, XValues[i]);
|
||||||
MinX := Min(MinX, XValues[i-1]);
|
MinX := Min(MinX, XValues[i]);
|
||||||
for j := 0 to NoY - 1 do
|
for j := 0 to NoY - 1 do
|
||||||
begin
|
begin
|
||||||
YValues[j, i-1] := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[selected[j], i]));
|
// Unlike other usages of 2-D arrays in LazStats the 1st index is the
|
||||||
MaxY := Max(MaxY, YValues[j, i-1]);
|
// curve index while the 2nd index is the point index here.
|
||||||
MinY := Min(MinY, YValues[j, i-1]);
|
YValues[j, i] := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[selected[j], i+1]));
|
||||||
|
MaxY := Max(MaxY, YValues[j, i]);
|
||||||
|
MinY := Min(MinY, YValues[j, i]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -332,6 +336,8 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
// Routine to plot X versus multiple Y values
|
// Routine to plot X versus multiple Y values
|
||||||
|
// Unlike many other routines in LazStats the curve index in YValues is the
|
||||||
|
// first one, the point index is the second one.
|
||||||
{$IFDEF USE_TACHART}
|
{$IFDEF USE_TACHART}
|
||||||
procedure TXvsMultYForm.PlotXY(XValues: DblDyneVec; YValues: DblDyneMat);
|
procedure TXvsMultYForm.PlotXY(XValues: DblDyneVec; YValues: DblDyneMat);
|
||||||
var
|
var
|
||||||
|
@ -67,10 +67,10 @@ var
|
|||||||
i, j: integer;
|
i, j: integer;
|
||||||
begin
|
begin
|
||||||
Result := true;
|
Result := true;
|
||||||
for i := 1 to NoVars do
|
for i := 0 to NoVars-1 do
|
||||||
begin
|
begin
|
||||||
j := GridPos[i-1];
|
j := GridPos[i];
|
||||||
if not ValidValue(Row,j) then
|
if not ValidValue(Row, j) then
|
||||||
Result := false;
|
Result := false;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -959,11 +959,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
xvalue := Trim(OS3MainFrm.DataGrid.Cells[col,row]);
|
xvalue := Trim(OS3MainFrm.DataGrid.Cells[col,row]);
|
||||||
if (xvalue = '') and (DictionaryFrm.DictGrid.Cells[4,col] <> 'S') then
|
if (xvalue = '') and (DictionaryFrm.DictGrid.Cells[4, col] <> 'S') then
|
||||||
valid := false;
|
valid := false;
|
||||||
if valid then // check for user-defined missing value
|
if valid then // check for user-defined missing value
|
||||||
begin
|
begin
|
||||||
if Trim(DictionaryFrm.DictGrid.Cells[6,col]) = xvalue then
|
if Trim(DictionaryFrm.DictGrid.Cells[6, col]) = xvalue then
|
||||||
valid := false;
|
valid := false;
|
||||||
end;
|
end;
|
||||||
Result := valid;
|
Result := valid;
|
||||||
|
Reference in New Issue
Block a user