jl66

asked on

# How to read data in Scentific notation in Fortran90

Have data set as follows

ABC 1 4.2023E-02 100.1

AAA 10 1.2345E-03 200.2

.....

How to read the data into the variables in FORTRAN 90?? I tried the following, but it did not work.

read(UNIT=1, '(A3, I3, E7.4, F6.1)', END=25) NAME, ID, VAL1, VAL2

Gurus, please advise.

ABC 1 4.2023E-02 100.1

AAA 10 1.2345E-03 200.2

.....

How to read the data into the variables in FORTRAN 90?? I tried the following, but it did not work.

read(UNIT=1, '(A3, I3, E7.4, F6.1)', END=25) NAME, ID, VAL1, VAL2

Gurus, please advise.

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

Excellent!

read(UNIT=1, '(A3, I3, F7.0, F6.0)', END=25) NAME, ID, VAL1, VAL2

this should work correctly regardless of the number of digits you have after the decimal point in your floating point numbers, and regardless of having exponential notation or not, the only constraint is that the length of each field (including possible blanks) is fixed, so 7 and 6 characters respectively for the two real numbers.