program sorder implicit none real*8 x,y integer*4 i,j,n,npmax,np logical lex character*80 s80 real*8,allocatable::xs(:,:),ys(:,:) integer*4,allocatable::nps(:) logical,allocatable::scale(:) write(6,600) 600 format(/,' Put spectra in SLIST.TXT to SLIST.PRN',/, 1 ' just to make Sigmaplot import easier',/) inquire(file='SLIST.TXT',exist=lex) if(.not.lex)then write(6,*)'SLIST.TXT not found' stop endif n=0 npmax=0 open(9,file='SLIST.TXT') 1 read(9,900,end=99,err=99)s80 900 format(a80) open(10,file=s80) np=0 2 read(10,*,end=88,err=88)x,y np=np+1 goto 2 88 close(10) if(np.gt.npmax)npmax=np n=n+1 goto 1 99 close(9) write(6,*)n,' spectra, maximal number of points:',npmax allocate(xs(n,npmax),ys(n,npmax),nps(n),scale(n)) open(9,file='SLIST.TXT') do 3 i=1,n read(9,900)s80 open(10,file=s80) np=0 4 read(10,*,end=77,err=77)x,y np=np+1 xs(i,np)=x ys(i,np)=y goto 4 77 close(10) 3 nps(i)=np write(6,*)'spectra loaded' c does it have the same scale as previous spectrum: scale(1)=.false. do 7 i=2,n 7 scale(i)=nps(i).eq.nps(i-1).and.xs(i,1).eq.xs(i-1,1).and. 1xs(i,2).eq.xs(i-1,2).and.xs(i,nps(i)).eq.xs(i-1,nps(i-1)) write(6,*)scale open(9,file='SLIST.PRN') do 5 j=1,npmax do 6 i=1,n if(j.le.nps(i))then x=xs(i,j) y=ys(i,j) else x=0.0d0 y=0.0d0 endif if(scale(i))then write(9,902)y 902 format(E12.4,$) else write(9,901)x,y 901 format(f12.2,E12.4,$) endif 6 continue 5 write(9,*) close(9) write(6,*)'SLIST.PRN written' end