Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

about loop

Status
Not open for further replies.

momphy

Programmer
Jul 16, 2012
14
US
Hi guy
i use a loop to read different file data and find each file data's peak. but i found the output are same .
here is my code :
program rfcc

character*32,dimension(20,160)::synfile
character*32 syn,syn1,syn2
real,allocatable,dimension:))::syndata
real synlen,beg,del,MAX,nerr
real,dimension(5000)::synpk
integer datalen

datalen=5000
syn='syndata/synfile.txt'
open(100,file=syn)
read(100,*)synfile
print*,synfile
syn1='syndata/'
! do i=1,20
! do j=1,160
syn2=trim(syn1)//'59.82.025.eqr'
allocate(syndata(datalen))
call rsac1(syn2,syndata,synlen,beg,del,MAX,nerr)
bel=locatepk(syndata)
print*,bel,syn2,syndata
deallocate(syndata)
! end do
! end do


end program rfcc
~ ***********and out put
20.01.600.eqr 20.01.625.eqr 20.01.650.eqr 20.01.675.eqr 20.01.700.eqr 20.01.725.eqr 20.01.750.eqr 20.01.775.eqr 20.01.800.eqr 20.01.825.eqr 20.01.850.eqr 20.01.875.eqr 20.01.900.eqr 20.01.925.eqr 20.01.950.eqr 20.01.975.eqr 20.02.000.eqr 20.02.025.eqr 20.02.050.eqr 20.02.075.eqr 20.31.600.eqr 20.31.625.eqr 20.31.650.eqr 20.31.675.eqr 20.31.700.eqr 20.31.725.eqr 20.31.750.eqr 20.31.775.eqr 20.31.800.eqr 20.31.825.eqr 20.31.850.eqr 20.31.875.eqr 20.31.900.eqr 20.31.925.eqr 20.31.950.eqr 20.31.975.eqr 20.32.000.eqr 20.32.025.eqr 20.32.050.eqr 20.32.075.eqr 20.51.600.eqr 20.51.625.eqr 20.51.650.eqr 20.51.675.eqr 20.51.700.eqr 20.51.725.eqr 20.51.750.eqr 20.51.775.eqr 20.51.800.eqr 20.51.825.eqr 20.51.850.eqr 20.51.875.eqr 20.51.900.eqr 20.51.925.eqr 20.51.950.eqr 20.51.975.eqr 20.52.000.eqr 20.52.025.eqr 20.52.050.eqr 20.52.075.eqr 20.81.600.eqr 20.81.625.eqr 20.81.650.eqr 20.81.675.eqr 20.81.700.eqr 20.81.725.eqr 20.81.750.eqr 20.81.775.eqr 20.81.800.eqr 20.81.825.eqr 20.81.850.eqr 20.81.875.eqr 20.81.900.eqr 20.81.925.eqr 20.81.950.eqr 20.81.975.eqr 20.82.000.eqr 20.82.025.eqr 20.82.050.eqr 20.82.075.eqr 21.01.600.eqr 21.01.625.eqr 21.01.650.eqr 21.01.675.eqr 21.01.700.eqr 21.01.725.eqr 21.01.750.eqr 21.01.775.eqr 21.01.800.eqr 21.01.825.eqr 21.01.850.eqr 21.01.875.eqr 21.01.900.eqr 21.01.925.eqr 21.01.950.eqr 21.01.975.eqr 21.02.000.eqr 21.02.025.eqr 21.02.050.eqr 21.02.075.eqr 21.31.600.eqr 21.31.625.eqr 21.31.650.eqr 21.31.675.eqr 21.31.700.eqr 21.31.725.eqr 21.31.750.eqr 21.31.775.eqr 21.31.800.eqr 21.31.825.eqr 21.31.850.eqr 21.31.875.eqr 21.31.900.eqr 21.31.925.eqr 21.31.950.eqr 21.31.975.eqr 21.32.000.eqr 21.32.025.eqr 21.32.050.eqr 21.32.075.eqr 21.51.600.eqr 21.51.625.eqr 21.51.650.eqr 21.51.675.eqr 21.51.700.eqr 21.51.725.eqr 21.51.750.eqr 21.51.775.eqr 21.51.800.eqr 21.51.825.eqr 21.51.850.eqr 21.51.875.eqr 21.51.900.eqr 21.51.925.eqr 21.51.950.eqr 21.51.975.eqr 21.52.000.eqr 21.52.025.eqr 21.52.050.eqr 21.52.075.eqr 21.81.600.eqr 21.81.625.eqr 21.81.650.eqr 21.81.675.eqr 21.81.700.eqr 21.81.725.eqr 21.81.750.eqr 21.81.775.eqr 21.81.800.eqr 21.81.825.eqr 21.81.850.eqr 21.81.875.eqr 21.81.900.eqr 21.81.925.eqr 21.81.950.eqr 21.81.975.eqr 21.82.000.eqr 21.82.025.eqr 21.82.050.eqr 21.82.075.eqr 22.01.600.eqr 22.01.625.eqr 22.01.650.eqr 22.01.675.eqr 22.01.700.eqr 22.01.725.eqr 22.01.750.eqr 22.01.775.eqr 22.01.800.eqr 22.01.825.eqr 22.01.850.eqr 22.01.875.eqr 22.01.900.eqr 22.01.925.eqr 22.01.950.eqr 22.01.975.eqr 22.02.000.eqr 22.02.025.eqr 22.02.050.eqr 22.02.075.eqr 22.31.600.eqr 22.31.625.eqr 22.31.650.eqr 22.31.675.eqr 22.31.700.eqr 22.31.725.eqr 22.31.750.eqr 22.31.775.eqr 22.31.800.eqr 22.31.825.eqr 22.31.850.eqr 22.31.875.eqr 22.31.900.eqr 22.31.925.eqr 22.31.950.eqr 22.31.975.eqr 22.32.000.eqr 22.32.025.eqr 22.32.050.eqr 22.32.075.eqr 22.51.600.eqr 22.51.625.eqr

i only paste part of file name . this file are different . it seem syndata are same ,fortran can't assign different file data to one array(by loop ),this array is tempory , i just want to find peak of different file data .
 
fortran can't assign different file data to one array(by loop ),

No, this statement is wrong. However, you have to provide proper code to instruct fortran to do this, but fortran does this in most programs without problem.

Where does the input of the data take place? A very good rule is to nullify any array after it is allocated to clear the memory of data that were present in this location before. You would see if an update took place.

By the way, a common error in looking for extremes is not to reset the variable holding the max value for any new set of data. Use something small enough that any value in the array will exceed it. Otherwise if your maximum of file #2 is less than that of file #1, you will fail to catch it.

Norbert


The optimist believes we live in the best of all possible worlds - the pessimist fears this might be true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top