# [Fortran] Help Reading Complex 2D data

• Fortran
Dear All, Please, I am trying to read in a data shown in array form but no luck. The data is 10 by 10 with each 10 by 10 depicted by a local array, for e.g. 0 0 0 0 0 0. A sample of the code I tried using is as shown below and the data is as attached. Please, any help or suggestion will be highly appreciated.
Code:
Program readdata

real*8 r1,r2,r3,r4,r5,r6,r7,r8,r9,fill,akx,aky,akz,akx1,aky1,akz1
real*8 w(2500)
complex*16 Gsc(100,100)
integer i,j,k,l,m,i1
character*80 linemc

open(unit=40,file='datain.txt',status='unknown')

do i=1,1000
READ(40,*) akx, aky,akz,akx1,aky1,akz1 ! local array
!   do k=1,10
READ (40,*) ((Gsc(k,l), l = 1, 10), k = 1, 10)

!enddo
enddo

end program readdata

#### Attachments

• datain.txt
48.3 KB · Views: 431
Last edited by a moderator: