1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Basic fortran help: reading columns of data from a text file

  1. Oct 21, 2011 #1
    Hi everybody,
    I have 3 columns of data (3 different variables) and 400 rows. How would I set up a matrix/array sort of thing to read each row individually and store it in my fortran program to calculate equations at each step?

    What I have basically tried and cant get to work, I think it tries to read past the file all the time....
    do i=1,N ! Read matrix row-by-row
    'Equations calculating from each line'
    Any help? or does someone have part of a working program i can use and modify?
  2. jcsd
  3. Oct 22, 2011 #2
    Whenever I've read in matricies I'd use a read statement with an implied do loop. For instance:
    dimension a(400,3)
    do 1 i=1,400


    1 continue
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook