Reading an array from a text file into fortran

From: Glyn Edwards (glynedwards_at_fastmail.fm)
Date: 10/22/04


Date: Fri, 22 Oct 2004 10:57:54 +0100

Hi, I have what I hope is a simple question

in fortran 95 is there a simple way to read in data of the following form
into an array?

N 2
M 4

1.2 3.4 5.6 7.8
9.0 2.3 6.5 8.7

Ideally I'd like to read in N, M (I can do that) allocate an array such
that it has dimensions a(N,M) and then read in the values below into
the array like

a(1,1) a(1,2) a(1,3) a(1,4)
a(2,1) a(2,2) a(2,3) a(2,4)

I can't see how best to set up a read statement to fill in the array when
I have to read in the value of M at run time.

Any thoughts

Thanks

Glyn



Relevant Pages

  • Re: Who uses clapack?
    ... > functions like SUM and MAXVAL and the ability to use array sections ... > drastically change the meaning of a Fortran code. ... >>Have you ever seen those bills for a Fortran compiler for an ... engineering applications in the C and C++ languages. ...
    (comp.lang.fortran)
  • Re: Who uses clapack?
    ... > functions like SUM and MAXVAL and the ability to use array sections ... > drastically change the meaning of a Fortran code. ... >>Have you ever seen those bills for a Fortran compiler for an ... engineering applications in the C and C++ languages. ...
    (sci.math.num-analysis)
  • Re: Benchmarking APL
    ... with that of FORTRAN. ... APL a 400% gain in programming efficiency could be obtained with only ... Another good-for-APL array problem, vector convolution, gave these ... Tomcatv, one of the SPEC benchmarks, is more typical of large array ...
    (comp.lang.apl)
  • Re: dwarfdump -i on Fortran object code doesnt give me array dimensions
    ... The command dwarfdump -i will only give me the number of elements ... Fortran 77 doesn't have dynamic dimensioning, ... Those are the array dimensions in the order I declared them in Fortran. ...
    (comp.sys.sgi.misc)
  • Re: Mixing C++/Fortran using Two-Dimensional Array
    ... not a subset as in Fortran. ... if you really need it you can get the effect by an array of TYPE ... the lowest-level base element pointer, which is all you actually need ... macros in C, although it can be difficult to find macro names that are ...
    (comp.lang.fortran)