Hello Everyone,
I am attempting to read a .vtk type data file that was generated, partially, with the code below:
do k=1,npts3
do j=1,npts2
do i = 1,npts1
write(93,fmt=‘(256(g6.4))’) array1(i,j,k)
write(101,fmt=‘(256(g6.4))’) array1(i,j,k)
end do
end do
enddo
array1 is integer type
I am trying to read the .vtk file with this below:
do k = 1,tnpts3
do j = 1,tnpts2
do i = 1,tnpts1
read(232,*) array2(i,j,k)
enddo
enddo
enddo
array2 is integer type
This always produces a “Fortran runtime error: Bad integer for item1 in list input”
I have also tried with ‘(I6)’ as the fmt indicator to a similar error.
I have also tried with ‘(A5,I1)’ since I know the integer is a single digit and the width of this would be 6 (5 leading spaces) based on the original format.
It properly reads the data if i just write either format outside of the nested loops.
Anyone have insight on how this could be done iteratively? I would really like to access this data outside of a software that reads the file.
Thanks!