我是熟悉Delphi编码和读取.txt文件的新手.我试图从.txt文件中读取输入数据(选项卡式双打),其中每列都被视为变量(日,温度,压力......),每一行都被视为时间步长(小时).如何将这些数据读入数组,以便用这些变量进行每小时计算(逐行)?
非常感谢您的任何建议!
输入样本(.txt文件中的选项卡式双打):
1 0.5 0 -12.6 -1.39 100 -19.5 0 3.3
1 1 0 -12.6 -1.43 100 -19.8 0 3.3
1 1.5 0 -12.7 -1.51 99.9 -20.5 0 3.2
Run Code Online (Sandbox Code Playgroud)
我到目前为止(VCL表格申请):
var // Declaration of variables
Read: TRead;
i:Byte;
data:array of array of Integer; //Creation of dynamic array (adapts --> Setlength() command)
Input:TextFile;
Location:String;
Counter:Integer;
Maximum:Integer;
procedure TRead.Button1Click(Sender: TObject); // Button "Read" command
begin
Location:=Edit1.Text; // Path of inputfile from Form
AssignFile(Input,(Location+'\Test1.txt')); // Assigning inputfile
Reset(Input); // Open for read-write …Run Code Online (Sandbox Code Playgroud)