我的dat文件的格式是这样的:
H-Q
         x          y
    0.0000   171.8085
   82.4929   170.7447
  159.2967   171.2766
  287.3030   169.6809
  395.3972   169.6809
  534.7818   167.5532
  640.0314   167.0213
  776.5714   164.8936
  896.0440   162.7660
 1043.9623   160.1064
 1177.6578   156.9149
 1308.5086   153.1915 ymin + 1.8155E+001 + -9.7156E-004 * (x - xmin)^1 + -9.6657E-006 * (x - xmin)^2
1.7168E+002 + -9.7156E-004 * x^1 + -9.6657E-006 * x^2
1.7168E+002  -9.7156E-004  -9.6657E-006
我想通过打开文件,把Dat文件X,Y下面那两列坐标数据读到Tchart上,上面那两行H-Q,X,Y不读,下面的式子不读,我的代码是这样的。
var
  f:TextFile;
  str:string;
  t,t1:tstringlist;
  i:integer;
  s:string;
begin
  if Opendialog1.Execute then ;
  str:=copy(opendialog1.FileName,length(opendialog1.FileName)-2,3);
  if str='Dat' then
  begin
    t:=tstringlist.Create;
    t1:=tstringlist.Create;
    try
      begin
        t.LoadFromFile(OpenDialog1.FileName);
        i:=2;
        while i< t.count do
        begin
          if pos('ymin',t.strings[i])=0 then
          begin
            s:=t.strings[i];
            t1.DelimitedText:=s;
            Rx:=strtofloat(t1.Strings[0]);
            Ry:=strtofloat(t1.Strings[1]);
            PointsA.AddXY(Rx,Ry,t1.Strings[0]);
            PointsA.AddXY(Rx,Ry,t1.Strings[1]);
            inc(i);
          end else
          break;
        end;
        t.Free;
        t1.Free;
      end;
    finally
      closefile(f);
    end;
  end;
end;
希望各位高手能帮我解答,我用的是delphi7企业版,据说DelimitedText还有个什么BUG,不知道有影响没,谢谢!