![]() |
READ FORMAT (SET)Name:
SET READ FORMAT 5X,F6.0,F6.2,4X,2F5.0 SET READ FORMAT 10X,3E12.4,5X,F10.0 SET READ FORMAT DEFAULT
SET READ FORMAT 3F10.0
The E, F and X specifications may be repeated as many times as needed. There should be no spaces in the string given for the SET READ FORMAT.
Spreadsheets typically either left or right justify the entire field when exporting to an ASCII file so that the decimal points are not aligned. If you have a large file that is not aligned by the decimal point and you anticipate needing to read the file frequently, it may be worthwhile to read the file once in free-format and save it using a SET WRITE FORMAT to have a version of the file that is aligned on the decimal point. Then in subsequent reading of the file, you can use the SET READ FORMAT with the version of the file that is aligned on the decimal point.
The advantage of unformatted reads is that the data files are much smaller (typically by a factor of 10 or more) and reading the data is significantly faster (e.g., even reading large data files almost instantaneous). The disadvantage is that unformatted files are binary and thus cannot be modified or viewed with a standard text editor. Also, Fortran unformatted files are not transportable across different computer systems. An unformatted read is performed by entering the command:
and then entering a standard READ command. For example,
There are 2 ways to create the unformatted file in Fortran. For example, suppose X and Y are to be written to an unformatted file. The WRITE can be generated by:
The distinction is that the first method stores the data as X(1), Y(1), X(2), Y(2), ..., X(N), Y(N) while the second method stores all of X then all of Y. There is no inherent advantage in either method in terms of performance or file size. The SET READ FORMAT UNFORMATTED command assumes the first method. To specify the second method, enter the command:
Unformatted reading is supported only for variables or matrices (i.e., not for parameters, strings or character data). Also, it only applies when reading from a file. The limits for the maximum number of rows and columns for a matrix still apply. When reading a matrix, the number of columns must be specified via the SET UNFORMATTED COLUMNS command. For example,
SET UNFORMATTED COLUMNS 25 READ MATRIX.DAT M The maximum size of the file that Dataplot can read is equal to the workspace size on your implementation (2,000,000 rows by 10 columns on most installations). For larger files, it will read up to this number of data values. The data is assumed to be a rectangular grid of data written in a single chunk. Only single precision real numbers are supported. By default, the entire file (up to the maximum number of points) is read. Dataplot provides two commands to allow some control of what portion of the file is read:
SET UNFORMATTED RECORDS <value> The OFFSET specifies the number of data values at the begining of the file to skip. This is useful for skipping header lines (similar to a SKIP command for reading ASCII files) and other miscellaneous values. The RECORDS value is useful for reading part of a larger file. Be aware that Fortran unformatted files are not transportable across systems. This is due to the fact that the file contains various header bytes (the Fortran standard leaves implementation of this up to vendor) that are not standard. Also, the storage of real numbers can vary between platforms. This means that the SET READ FORMAT UNFORMATTED command can not be used to read raw binary files (as might be produced by a C program) and it cannot, in general, be used to read unformatted Fortran files created on systems other than the one you are running Dataplot on.
1995/04: support for reading unformatted Fortran files SKIP 25 SET READ FORMAT 3F7.0 READ ELLIOTTR.DAT RED ROWID COLID SET READ FORMAT
Date created: 06/07/2024 |
Last updated: 06/07/2024 Please email comments on this WWW page to [email protected]. |