Creating 2-d array from a text file in fortran

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 3K views
tcmoore3
Messages
1
Reaction score
0
I have a text file of the format

x1 y1
x2 y2
. .
. .
. .

I need to read this into an array. How is this done in Fortran?
 
Physics news on Phys.org
you start by declaring a couple of array variables long enough to accommodate your values.
then, you open the file
write a do-loop
read values into array with the loop variable as the index


If I tell you more, I will be writing more than what it takes to simply write the code and give it to you.

with those hints, go ahead and take a shot at it, don't be shy, write some code and see what happens...you are not going to break anything nor set the room on fire or anything...that's what so wonderful about software!