- #1
ade_tokunbo
- 2
- 0
Dear all,
I want to read data from a file which has four column and process the data for further calculation. After running the code it keeps given me 0.00000 as output. What do i do? Here is the structure of the code
program new
Implicit none
integer,parameter ::Nmax=1000
Integer :: i,io,max,t
Real*8,Dimension(Nmax) :: Ev,X,Y,Z
Real*8, Dimension(Nmax)::Evr,Xr,Yr,Zr
open(1, File='si.dat',status='old')
open(16,file='cal.dat',status='unknown')
max=0
do i=1,Nmax
read(1,*,IOSTAT = io)Ev(i),X(i),Y(i),Z(i)
if (io.eq.0) then
max = max+1
else
goto 677
endif
enddo
677 close(1)
do t=1,Nmax
open(1, file='si.dat',status='old')
do i=1,max
read(1,*,iostat=io)Ev(i),X(i),Y(i),Z(i)
enddo
write(6,*)Ev(t),X(t),Y(t),Z(t)
enddo
close(16)
end program
I want to read data from a file which has four column and process the data for further calculation. After running the code it keeps given me 0.00000 as output. What do i do? Here is the structure of the code
program new
Implicit none
integer,parameter ::Nmax=1000
Integer :: i,io,max,t
Real*8,Dimension(Nmax) :: Ev,X,Y,Z
Real*8, Dimension(Nmax)::Evr,Xr,Yr,Zr
open(1, File='si.dat',status='old')
open(16,file='cal.dat',status='unknown')
max=0
do i=1,Nmax
read(1,*,IOSTAT = io)Ev(i),X(i),Y(i),Z(i)
if (io.eq.0) then
max = max+1
else
goto 677
endif
enddo
677 close(1)
do t=1,Nmax
open(1, file='si.dat',status='old')
do i=1,max
read(1,*,iostat=io)Ev(i),X(i),Y(i),Z(i)
enddo
write(6,*)Ev(t),X(t),Y(t),Z(t)
enddo
close(16)
end program