Re: opening existing files with OPEN()
- From: harper@xxxxxxxxxxxxx (John Harper)
- Date: 13 Sep 2007 10:55:23 +1200
In article <1189606396.692830.231870@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<maserda@xxxxxxxxx> wrote:
Sorry for the delay, but I was unfamiliar on how this thing notified
the creator of any replies.
The file I am asking for it to find is a copy of a small portion of a
very large raw data file (just for me to make sure the program works
before I try running it on the real thing). The data in the file is
in the following format:
234843.23,4782438.85,239.42
458394.34,2204845.34,247.60
...
(just an example of the numerical values, but the format/style is the
same)
(and yes, there aren't any spaces in any of the lines)
So one of the issues I was trying to solve before my posted problem
was getting the program to read this format correctly.
List-directed read (i.e. format * ) is the simplest, and it can cope
with numbers separated by either commas or blank spaces, in either
f77 or f95. I presume that as you have 9 significant figures in some
of the input you want floating-point numbers to be double precision.
So if the file you read has been opened as unit 66 (say) and has at
least n lines, each like the above and containing nothing else,
and if n is an integer constant and i an integer variable, then you
could read those 3*n numbers with
DOUBLE PRECISION x(n),y(n),z(n)
OPEN(66, ...)
READ(66,*) (x(i),y(i),z(i),i=1,n)
after which you should have
x(1) = 234843.23d0 y(1) = 4782438.85d0 z(1) = 239.42d0
x(2) = 458394.34d0 y(2) = 2204845.34d0 z(2) = 247.60d0
etc. If n is not a constant but may vary then your programming has to
be more complicated. Others have mentioned what to do with OPEN.
-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper@xxxxxxxxx phone (+64)(4)463 5341 fax (+64)(4)463 5045
.
- References:
- opening existing files with OPEN()
- From: maserda
- Re: opening existing files with OPEN()
- From: maserda
- opening existing files with OPEN()
- Prev by Date: Re: Which compiler can compile .ift file.
- Next by Date: Re: Which compiler can compile .ift file.
- Previous by thread: Re: opening existing files with OPEN()
- Next by thread: NOS compilers available
- Index(es):
Relevant Pages
|