Fortran Read Last Line From File

Posted on -
Fortran Read Last Line From File 4,3/5 6597 reviews

Each Fortran read statement, by default, reads a list of values and then advances to the beginning of the next line. Think of read as moving a cursor through the input file as it works. So your statement. Read(100,*) test does what you expect when the numbers in the input file are on separate lines.

Posted by7 years ago
Archived

Fortran noob: How do you read a specific line out of a file?

So I just started Fortran and I need to make a simple program to read a specific line out of a file.

The file is a (n x m) array of floating point numbers in white-space delimited text format:

3.0000000e+06 1.0000000e+00 1.3506000e-02 3.0000000e+06 2.0000000e+00 1.9389000e-02 3.0000010e+06 1.0000000e+00 1.9422000e-02 3.0000010e+06 2.0000000e+00 2.4908000e-02

Fortran Read Function

Like above, except I have around 100,000 entries.

I want to be able to read a specific row (say line 6000) and assign that row of data into variables: something like

I know this should be something very easy to write but I just suck at Fortran :(. Rather be coding in Python but some shitty scripting interface requires Fortran (ie Abaqus) Can anyone help?

Fortran Read End

/Sorry, I'm not sure how to format with Reddit which changes my greater/less than signs into something weird

Fortran read write format
85% Upvoted