You've already forked lazarus-ccr
LazStats: Fix usage of invalid rows in WLSUnit. Cleanup.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7781 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -75,27 +75,29 @@ end;
|
||||
{ Extracts the grid values from the columns with indices given by AColIndices
|
||||
and puts them into the columns of the result matrix.
|
||||
This means: The result matrix contains the variables as columns and the
|
||||
cases as rows. }
|
||||
cases as rows.
|
||||
"Bad" records (filtered, empty) are skipped. }
|
||||
function CollectMatValues(AGrid: TStringGrid; AColIndices: IntDyneVec): DblDyneMat;
|
||||
var
|
||||
nr, r, c, i, j: Integer;
|
||||
r, c, i, j: Integer;
|
||||
val: Double;
|
||||
begin
|
||||
SetLength(Result, AGrid.RowCount, Length(AColIndices));
|
||||
nr := 0;
|
||||
i := 0;
|
||||
for r:= 1 to AGrid.RowCount-1 do
|
||||
begin
|
||||
if not GoodRecord(AGrid, r, AColIndices) then Continue;
|
||||
i := r - 1;
|
||||
for j := 0 to High(AColIndices) do
|
||||
begin
|
||||
c := AColIndices[j];
|
||||
if TryStrToFloat(trim(AGrid.Cells[c, r]), val) then
|
||||
Result[i, j] := val;
|
||||
Result[i, j] := val
|
||||
else
|
||||
Result[i, j] := NaN;
|
||||
end;
|
||||
inc(nr); // count the number of rows in the matrix.
|
||||
inc(i);
|
||||
end;
|
||||
SetLength(Result, nr);
|
||||
SetLength(Result, i);
|
||||
end;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user