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....



LoadFromFile


Unit:SDL_matrix
Class: TMatrix, TIntMatrix
Declaration: [1] function LoadFromFile (FileName: string; AdjustMatrixSize: boolean): boolean;
[2] function LoadFromFile (FileName: string; AdjustMatrixSize, AutoDetect: boolean): boolean;

The function LoadFromFile loads the matrix elements which have been stored previously by the method StoreOnFile. The parameter FileName specifies the name of the data file. LoadFromFile returns a TRUE value, if the data have been successfully read from the disk. If the parameter AdjustMatrixSize is set to TRUE, the matrix size is adjusted to hold the entire data on the file. If AdjustMatrixSize is FALSE the data will be only read if it fits into the existing matrix.

If the parameter AutoDetect is TRUE, it is assumed that the matrix file does not contain any header information. In this case the procedure tries to find the dimensions of the matrix automatically by counting the lines and the white space between individual numbers. Omitting the AutoDetect parameter defaults to AutoDetect=FALSE. Please note that AutoDetect requires considerable time if the data file is large.

Hint: The function LoadFromFile can be used to read any external data into a matrix. The only prerequisite is to use the correct format of the data file. The numbers should be stored as ASCII-strings of any format and have to be separated by at least one blank (ASCII 32) or a tab character (ASCII 9).

Example: The statement reslt := Mat.LoadFromFile ('TEST.TBL', false); tries to load data from the file TEST.TBL into matrix Mat, and passes the value TRUE to the variable reslt , if the data have been read successfully.


Last Update: 2015-May-29