A scalar appended to the file name, file\n, specifies the starting record. The first n-1 records will be skipped. A vector appended to the file name, file\x, specifies each record to read. The first x[1]-1 records will be skipped. The data will be read from records x[1], x[2], ..., x[#]. Records x[1]+1 to x[2]-1 will be skipped. The vector x must be monotonically increasing.
Syntax: READ file{\line_range} x1{\c1} { x2{\c2} ... } By default, the I_th column is placed into vector xI. The column number can be specified by appending a scalar, cI, to the vector name as a qualifier. In this case, the cI_th column can be placed into the xI vector. For example, after READ DUM.DAT W\2 X\4 Y Z\1 W would contain column 2, X would contain column 4, Y would default to column 3, and Z would contain column 1.
Syntax: READ\FORMAT file{\line_range} (frmt) x1 { x2 ... } The \FORMAT qualifier must be used to indicate that a format is present. The format must be enclosed in parentheses, ( and ). If a format is used, column numbers cannot be specified. Standard FORTRAN formats are valid, but only REAL variables can be read, so do not use INTEGER, LOGICAL or CHARACTER formats. All values are converted to REAL*8 for internal storage.
To read only a certain number of elements into vectors use the \NOEXTEND, or \-EXTEND, qualifier. The output length of a vector will be number of values that are read, to a maximum of that vector's original length. For example, suppose that vector X has length 10 and vector Y has length 20. If you enter: READ\-EXTEND file\[1:20] X Y and 20 records are read, vector X will be made with a length of 10 and vector Y will be made with a length of 20. If only 15 records are read, vector X will have length 10 but vector Y will only have length 15. By default, a new vector is created to hold the newly read data. If the \OVERLAY qualifier is used, an existing vector will have the newly read data overlayed on the original data. The resultant vector length may be longer, but never shorter. Use the \APPEND qualifier to append the newly read data onto the end of existing vectors. \-EXTEND is incompatible with \OVERLAY. \-EXTEND is incompatible with \APPEND.
Additional Information on:
Records beginning with ! are considered to be comments and are ignored. By default, \ERRSTOP, an invalid field stops the read, but the data that has been read up to the error is saved. If the \ERRSKIP qualifier is used, an invalid field causes the entire record to be skipped. If the \ERRFILL qualifier is used, an invalid field causes the entire record to be filled with the value of ERRFILL if a format was entered, or only the invalid field will be set to ERRFILL if no format was entered. By default, ERRFILL=0, but it's value can be changed with the SET command and it's value obtained with the GET command.
1 2 3 4 5 6 Suppose ASCII file DUM.DAT is: 7 8 9 10 11 12 13 14 15 16 17 18 READ DUM.DAT 3X 2Y Z results in: X = [ 1; 2; 3; 7; 8; 9; 13; 14; 15 ] Y = [ 4; 5; 10; 11; 16; 17 ] Z = [ 6; 12; 18] READ DUM.DAT X X X results in: X = [1;2;3;7;8;9;13;14;15] READ DUM.DAT 6X results in: X = [1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18]
1 23.7 0.1000E-5 2 -31.4 0.2000E-3 Suppose ASCII file DUM.DAT is as follows: 3 9.09 0.3000E-1 4 10.001 0.4000E+1 5 -2.0 0.5000E+2 6 30.2 0.6000E+3 READ DUM.DAT X Y results in: X = [ 1; 2; 3; 4; 5; 6 ] Y = [ 23.7; -31.4; 9.09; 10.001; -2.0; 30.2 ] READ DUM.DAT\3 X Y results in: X = [ 3; 4; 5; 6 ] Y = [ 9.09; 10.001; -2.0; 30.2 ] READ DUM.DAT\[2:4] X\3 Y results in: X = [ .0002; .03; 4.0 ] Y = [ -31.4; 9.09; 10.001 ] READ\FORMAT DUM.DAT\[1:5:2] (2X,F8.4,E9.4) X Y results in: X = [ 23.7; 9.09; -2.0 ] Y = [ .000001; .03; 50.0 ]
macro below reads data into vectors allowing DUM.DAT is below: the user to choose when to stop reading ------------------- -------------------------------------------- 10 20 30 LNUM = 1 40 50 60 START: 70 80 90 READ DUM.DAT\LNUM X Y Z this is a test IF ~EXIST(`X') THEN GOTO DONE ! end of file 100 200 300 LIST X Y Z 400 500 600 ANS=`Y' 700 800 900 INQUIRE `read again ? (Y|n)' ANS test line two IF NES(UCASE(ANS),`Y') THEN GOTO DONE -10 -20 -30 LNUM = LEN(X)+LNUM+1 -40 -50 -60 GOTO START -70 -80 -90 DONE: