|The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....|
|Home MathPack DataTable Using TDataTable|
|See also: Nominal and Ordinal Data, Using TDendrogram|
The unit TDataTable implements an often needed data structure when working with measurement data. It combines a rectangular numeric matrix with additional information, such as row and column names, cell states, or attributes.
The data of the matrix can be accessed by using the public identifier NumericData or the array property Elem. Please note that the data is always stored in floating point format, values of categorical variables are represented by the (rounded) ordinal value (see Nominal and Ordinal Data for more).
The size of the matrix is controlled by the properties NrOfRows and NrOfColumns. Changing its size can also be accomplished by using the method Resize. Please note that any change in matrix size triggers the OnResize event. Row and column attributes: each row or column has a numeric attribute between 0 and 255. These attributes may be used to assign different classes to some of the rows (array property RowAttrib), or columns (array property ColAttrib). The row and column names may have a maximum length of DT_NameWidth characters and can be accessed by the array properties RowName and ColName.
In order to cope with different cell states each cell of the data matrix may assume a combination of up to 8 independent states (8 bits per cell). These cell states can be used to indicate certain aspects of the data (e.g. for marking part of the data). The cell states can be manipulated by the array property CellState. The methods IfColHasCellState and IfRowHasCellState allow you to test the cell states of entire columns or rows. There are several statistical methods which evaluate the cell states and use only those cells which are neither marked as csNAN, nor as csUndefined: CountNumCells, MeanVarOfNumCells, MinMaxOfNumCells, PercentileOfNumCells, QuartilesOfNumCells, SumOfNumCells, HarmonicMeanOfNumCells, and GeometricMeanOfNumCells.
Finally, TDataTable also stores a comment of arbitrary length which is accessible via the property Comment.
The data of the data table may be imported and exported from and to a simply formatted ASCII file by using ImportASC and ExportAsASC. The method ReadFromASC is comparable to ImportASC but allows you to position to the read data in the data table. Note that there is also the general procedure ReadHeaderOfASC which is not a method of TDataTable. This procedure allows you to read the header information of ASC formatted files without the need to create an instance of TDataTable. Another method of importing data into the data table is either to copy data from an external TDataTable instance by using the method CopyContentsFrom, or to assign an external TMatrix instance to the TDataTable by using the method AssignAnotherDataMatrix. In this case the data is not copied but referenced.