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



StoreArray


Unit:SDL_openarrays
Class: none
Declaration: [1] function StoreArray (FName: string; Arr: TIntArray; Comment: string): integer;
[2] function StoreArray (FName: string; Arr: TInt2DArray; Comment: string): integer;
[3] function StoreArray (FName: string; Arr: TInt3DArray; Comment: string): integer;
[4] function StoreArray (FName: string; Arr: TInt4DArray; Comment: string): integer;
[5] function StoreArray (FName: string; Arr: TInt3DArray; InsertIndices: boolean; Comment: string): integer;
[6] function StoreArray (FName: string; Arr: TInt4DArray; InsertIndices: boolean; Comment: string): integer;
[7] function StoreArray (FName: string; Arr: TDoubleArray; Comment: string): integer;
[8] function StoreArray (FName: string; Arr: TDouble2DArray; Comment: string): integer;
[9] function StoreArray (FName: string; Arr: TDouble3DArray; Comment: string): integer;
[10] function StoreArray (FName: string; Arr: TDouble4DArray; Comment: string): integer;
[11] function StoreArray (FName: string; Arr: TDouble3DArray; InsertIndices: boolean; Comment: string): integer;
[12] function StoreArray (FName: string; Arr: TDouble4DArray; InsertIndices: boolean; Comment: string): integer;

The function StoreArray stores the data of the array Arr in the file specified by the parameter FName. The parameter Comment may contain any single-line comment which is stored with the data. Please note that any control characters in the comment are automatically removed before storing it (in order to ensure that the comment is a single line).

The data matrix is stored as a text file using full floating point precision (15 digits). The first line of the file contains the version number, the second line the comment and the third line contains the number of columns and rows (separated by a blank). The following lines contain the data values.

As an option for three and four dimensional arrays (overloaded versions [5], [6], [11] and [12]) you can set the parameter InsertIndices to TRUE. This forces the function to insert the layer and time slot indices into the data file. Please note that this is mainly for debugging purposes and should not be used on regular cases. Versions [1] to [4] and [7] to [10] do not write any indices on the file and are the preferred versions if the stored data should be loaded from disk later (data files with inserted indices cannot be read by LoadArray).

The function returns the following error codes:

 0 ... everything is OK
-1 ... FName is empty or Arr has a length of zero
-2 ... file write error (readonly, disk full)


Last Update: 2023-Feb-06