- #1
autobot.d
- 68
- 0
I am trying to write code so a 2-d array is written to the hard drive (which is later to be read). There are several do loop iterations and I would like the file name to change with every iteration so I get as many files as there are loop iterations. I get one 1-d array that is named A, no extension and that is the only one as well. The 1-d array is fine, I will just Shape to change it to a 2-d array, but the file names is getting me. Here is just a snippet of the code. If more is needed let me know. Thanks!
Code:
miscellaneous code here...
........
.......
integer :: n
CHARACTER :: filename,num
do i = 1,n
...
!Important part of code
filename = 'MatrixOut' //num//'.dat' !num looks to be the problem, I tried putting an
!integer there that =i but that is an error
OPEN (UNIT = 8, FILE=filename, STATUS = 'REPLACE', IOSTAT = ierror)
do j=1,n
do k = 1,n
WRITE (8,"(1000(1x,f0.6))") (Matrix_Out(j,k))
end do
end do