file - How to fill a matrix with data in Fortran 90 -
i have issue, maybe stupid, code wrote. generated 30 datasets of 24 lines containing different values represent, however, same measure, can not print them in array format. let me explain, single column values, able write them matrix of 24 rows 30 columns. tried read various threads on site , on others, got matrices of zeros alternating values, how can do? following code wrote trying matrix "a" formed values of "diffu"
program deviation implicit none character(len=20) :: filein,fileout,fileinp integer :: row,i,h,io,n,j,l,m,col real :: usv,usf,tsv,tsf,su,st real :: diffu, difft real, dimension(24,30) :: real, dimension(720) :: u n = 39 row = 24 col = n-9 write(*,'(2x,''input file .......''/)') read(*,'(a15)') filein write(*,'(2x,''output file........''/)') read(*,'(a15)') fileout open(unit = 20,file=fileout) = 0. fileloop : = 10,n fileinp = 'lin*27-' write(fileinp, '("lin*27-",i2,".dat")') open(unit = i+40,file=fileinp) open(unit = 30,file=filein) j = 1, row read(30,*,iostat = io) h,usv,tsv read(i+40,*,iostat = io) h,usf,tsf if(io/=0) write(*,*) 'end of file!' exit else if(io==0) diffu = ((usf - usv)**2) difft = ((tsf - tsv)**2) write(20,*) diffu,difft endif enddo enddo close(i+40) close(30) enddo fileloop close(20) open(unit=20,status='old',file=fileout) r = 1, 720 read(20,*,iostat = io) diffu,difft u(r) = diffu if(io/=0) write(*,*) "error!" exit else if(io==0) m = 1, 24 l = 1, col a(m,l) = a(m,l) + u(r) enddo enddo endif enddo write(*,*) close(20) end program deviation
Comments
Post a Comment