ReadTextFile (FPScript)
Reads a data set from a text file. This is a deprecated function! Use the
Syntax
ReadTextFile(TextFile, FromLine, ToLine, FromColumn, ToColumn, DataMatrix, DataType, Comma, ColumnSeparator [ , SingleSeparator = FALSE ])
The syntax of the ReadTextFile function consists of the following parts:
Part |
Description |
||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TextFile |
String with the path of the text file to be read. Permitted data structures are scalar value. Supported data types are string (file name). If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||||||||||||||||||||||||||
FromLine |
Number of the first line to be read. Permitted data structures are scalar value. All integral data types are permitted. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
||||||||||||||||||||||||||||||
ToLine |
Number of the last line to be read. If ToLine is equal to 0, the file is read through to the end. Permitted data structures are scalar value. All integral data types are permitted. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
||||||||||||||||||||||||||||||
FromColumn |
Number of the first column to be read. Permitted data structures are scalar value. All integral data types are permitted. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
||||||||||||||||||||||||||||||
ToColumn |
Number of the last column to be read. Permitted data structures are scalar value. All integral data types are permitted. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
||||||||||||||||||||||||||||||
DataMatrix |
Boolean value, which specifies that the data set is to be read as a data matrix. Permitted data structures are scalar value. Supported data types are Boolean value. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
||||||||||||||||||||||||||||||
DataType |
Specifies the data type in which the data set is to be read. For data in calendar time or time span format, a string with the date format is specified using the following characters:
The argument DataType can have the following values:
If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
||||||||||||||||||||||||||||||
Comma |
A Boolean value, which specifies that the comma ',' is the decimal separator for floating point values in the file. If Comma is equal to FALSE, then the function expects a period '.' as the decimal separator. Permitted data structures are scalar value. Supported data types are Boolean value. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
||||||||||||||||||||||||||||||
ColumnSeparator |
A string with the column separator characters used in the text file. Permitted data structures are scalar value. Supported data types are string. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
||||||||||||||||||||||||||||||
SingleSeparator |
A Boolean value. The value TRUE specifies that after every column separator, a change of columns is to be assumed. FALSE specifies that with subsequent column separators, only one change of columns is to be assumed. Permitted data structures are scalar value. Supported data types are Boolean value. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. If this argument is omitted, it will be set to the default value FALSE. |
Remarks
Floating point values can contain an exponent, which must start with the letter 'E' or 'e', for instance, 1.23e-12. If an entry in the file cannot be interpreted as a number, then a void floating point value is entered at the corresponding location in the result. ReadTextFile can read data series and data matrices. If you read several columns as a data series, the columns are appended to one another, from left to right.
Available in
FlexPro View, Basic, Professional, Developer Suite
Examples
ReadTextFile("c:\\examples\\file.txt", 2, 0, 2, 2, FALSE, TYPE_FLOATINGPOINT64, TRUE, "\t", FALSE)
Reads the second column from the text file c:\examples\file.txt. It starts from the second line, and tabs are used for the column separator.