1

I was wondering how I can read a matrix in a file to Fortran 90 in case dimension of matrix is not known. I know how to get the number of rows for the matrix but have no idea how should know column number to allocate a matrix inside program. lets say matrix is like this

1 2 3 4 50
2 50 2 50 1
21 3 15 515 7 

I got this for getting number of rows of external file:

! GETTING NUMBER OF ROWS
open(unit=11, file=esmfile)
n=0
DO
  READ(11, *, IOSTAT=iostatus) dummy
  IF (iostatus < 0) EXIT
   n = n + 1
END DO
Alam_jorab
  • 119
  • 1
  • 8

0 Answers0