Загрузка матрицы из StringGrid
function LoadToMatrix(var Grid: TStringGrid; var M: TMatr): boolean;
var
i, j: integer;
begin
Result := true;
SetLength(M, Grid.ColCount, Grid.RowCount);
i := Grid.FixedRows;
j := Grid.FixedCols;
while ((i <= Grid.RowCount - 1) and Result) do
begin
while ((j <= Grid.ColCount - 1) and Result) do
begin
Result := TryStrToInt(Grid.Cells[j, i], M[i,j]);
inc(j);
end;
inc(i);
end;
end; |