Re: opening existing files with OPEN()



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
.



Relevant Pages

  • Re: Minus Zero
    ... "Precision as Formatted". ... with a General format when I realized that "precision as displayed" ... It might eliminate the need to use ROUND for the result of each cell. ... the result in A4 is now exactly zero. ...
    (microsoft.public.excel)
  • Re: Custom Format Limitation
    ... Excel, like nearly all software, uses for format called "Double Precision Floating Point" to store numbers. ... This is an industry-wide standard, kept by the Institute Of Electrical And Electronic Engineers -- it is in now way unique to Excel or to Microsoft product in general. ...
    (microsoft.public.excel.misc)
  • Re: Read Format
    ... That statement as is just skips a line, as you have no I/O ... array of double precision type. ... what your problem isn't - namely in the I/O format. ... DOUBLE PRECISION:: tol, sum_e2 ...
    (comp.lang.fortran)
  • Re: C code for converting IBM/370 floating point to IEEE 754?
    ... point format to IEEE 754 single precision format. ... the IBM format has greater range but less precision than the ... IEEE format. ...
    (comp.lang.c)
  • Re: 24bits conversion
    ... Invalid precision. ... fread with '*uint8' and typecastthe resulting byte stream to 'uint16'. ... format is "little-endian". ... while incount < len ...
    (comp.soft-sys.matlab)