Hello all !
files: CWxx.DAT where xx is the number which goes from 00 to xx
and they look like this:
14 lines of rubbish, and unknown number of lines of data (below)
3.500000E-01 5.427289 4.700469 7.268204E-01
4.000000E-01 6.566324 5.225193 1.341131
4.500000E-01 6.944819 5.329013 1.615806
5.000000E-01 6.206076 4.943774 1.262302
5.500000E-01 5.158059 4.395154 7.629050E-01
--------------(this line is not in file, just to show this is the end)
I'm trying to read the data so I can plot it. I've managed to come up
with some kooky solution for determining whether the file exists and
to read everything up to the data lines (see below, pay no attention
to the comments, they're here purely for the purpose of
self-confusion) but I'm having trouble finding a way in which I can
read the data lines up to the file end, and determining how many lines
I've read in that file.
Is there some common way this is usually done ? I searched the
archives, and found some examples. If I read it with read(1,*,end=...)
I don't see how I would be able to read how many lines I've read.
Please, any help on this would be appreciated.
regards
Luka
character(8) file_name
logical existence
character(100) not_im****tant_line
dimension fn(25),cw(25),cw0(25),cwi(25)
! Provjera koji fileovi CWxx.DAT postoje, i koji je zadnji xx
do 1 i=0,99
write(file_name,'("CW",i2.2,".DAT")')i
inquire(file=file_name, exist=existence)
if(.not.existence) then
! write(*,'(" File ",a8," ne postoji")')file_name
else
n_last_file=i
end if
1 continue
! ----------------------------
do 2 i=0,n_last_file
write(file_name,'("CW",i2.2,".DAT")')i
open(unit=1, file=file_name, status='old')
rewind(1)
do 3 j=1,14
read(1,'(a100)')not_im****tant_line
3 continue
do 4 j1=1,25
read(1,*)fn(j1),cw(j1),cw0(j1),cwi(j1)
4 continue
close(1)
2 continue
end program


|