Hi!
I have a 3D array u(n,m,2), where n=2000, m=200 are the xy-coordinates, and u(n,m,1) and u(n,m,2) store values of variables a and b computed at the coordinates.
(not very familiar with fortran I/O for arrays, when new lines are started, etc).
I'd like to output this array into a text file, and read it in at a later point in the program (fortran 95). The following output works fine, and is set up perfectly for gnuplot:
open(17,file='values.dat',action='write')
do x=1,n
do y=1,m
write(17,'(2(E10.4,1X))') u(x,y,1),u(x,y,2)
enddo
write(17,*) !skip a line
enddo
close(17)
This writes 2000 blocks of 200 x 2 arrays separated by a space, column 1 are 'a' values, column 2 'b' values.
How can I read this from values.dat into another 3D array later in the program, ie, v(n,m,2)? Is there a better way to write to the file (ie make two files, for a and b) that will make reading into v easier?
Thanks! =]
I have a 3D array u(n,m,2), where n=2000, m=200 are the xy-coordinates, and u(n,m,1) and u(n,m,2) store values of variables a and b computed at the coordinates.
(not very familiar with fortran I/O for arrays, when new lines are started, etc).
I'd like to output this array into a text file, and read it in at a later point in the program (fortran 95). The following output works fine, and is set up perfectly for gnuplot:
open(17,file='values.dat',action='write')
do x=1,n
do y=1,m
write(17,'(2(E10.4,1X))') u(x,y,1),u(x,y,2)
enddo
write(17,*) !skip a line
enddo
close(17)
This writes 2000 blocks of 200 x 2 arrays separated by a space, column 1 are 'a' values, column 2 'b' values.
How can I read this from values.dat into another 3D array later in the program, ie, v(n,m,2)? Is there a better way to write to the file (ie make two files, for a and b) that will make reading into v easier?
Thanks! =]