Example: |
The following code snippet creates a small data table, fills it with a constant value of 8.762813. The first column is renamed to 'FC', the second row is renamed to 'SR', all other columns and rows keep their default names. The exported ASC file is shown below.
const
PRECISION = 3;
MATNCOL = 3;
MATNROW = 6;
var
row : integer;
DT : TDataTable;
begin
DT := TDataTable.Create(nil);
DT.Resize (MATNCOL,MATNROW);
DT.Fill (0,0,0,0,8.762813);
DT.ColName[1] := 'FC';
DT.RowName[2] := 'SR';
DT.Comment := 'my special comment';
DT.ExportAsASCFile('c:\temp\testexpo.asc', PRECISION);
DT.free;
end;
The generated ASC file looks like this (see the ASC format specification for details):
my special comment
3 ;nr. of columns
6 ;nr. of rows
TRUE TRUE TRUE FALSE ;row attributes, column names, row names, nominal variables
FC C-2 C-3
0 R-1 8.763 8.763 8.763
0 SR 8.763 8.763 8.763
0 R-3 8.763 8.763 8.763
0 R-4 8.763 8.763 8.763
0 R-5 8.763 8.763 8.763
0 R-6 8.763 8.763 8.763
|