How to find the dimension of a matrix?
<p>I have a matrix that contains both character and reals and I want a program that reads this matrix (finds the dimensions by itself). Here is my code:</p>

<pre><code>! A fortran95 program for G95
Program Project2nd
implicit none
character(len=40), allocatable :: a(:,:)
integer i,j,k,n,m,l,st
character(len=40) d
n=0; m=1; j=1;

open(10,file=&amp;
 '/Users/dariakowsari/Documents/Physics/Programming/Fortran95-Projects/Project2nd/input.txt', &amp;
   IOstat=st)

do while (st == 0)
   read(10,*,IOstat=st) d
   n=n+1
end do

st=0
do j=1,m
  do while (st == 0)
     allocate(a(1,m))
        read(10,*,IOstat=st) (a(1,j),j=1,m)
          m=m+1
         deallocate(a)
 end do

 print*, n,m


end
</code></pre>

<p>Here is my Matrix:</p>

<pre><code>a   b   13   15.5   13.2
c   d   16   16.75  19
e   f   19.2 12.2   18.2
</code></pre>

<p>With this code I got (3,2) for the dimensions of my matrix.</p>