Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

Input data file with columns divided in blocks

Paulo_M_
Beginner
523 Views

Hello all,

I need to read a 62x14 table which is generated by an external program. However the external program splits the table in two parts, showing the first 10 columns and the remaining columns just below the first part. Is it possible to read such table in my Fortran code? What should be done?

 

Thanks,

 

Paulo

0 Kudos
1 Reply
mecej4
Honored Contributor III
523 Views

Assuming that the data files contains one block with 62 rows and 10 columns, and a subsequent block with 62 rows and four columns:

program tblread
implicit none
integer, parameter :: NROWS=62,NCOLS=14,NSPLT=10
real, dimension(NROWS,NCOLS) :: tbl
integer :: i,j
!
open(unit=11,file='...')
read(11,*)((tbl(i,j),j=1,NSPLT),i=1,NROWS)
read(11,*)((tbl(i,j),j=NSPLT+1,NCOLS),i=1,NROWS)
!
...
end program

 

0 Kudos
Reply