title: Error: Incompatible ranks 0 and 1 in assignment at (1) fortran
body: <p>I try to write a code but get the error on the top, my code is below. please help me.(I search the web but cannt solve the problem)</p>
  
  <pre><code>program deneme
    implicit none 
    integer::i,mtd
    integer, parameter :: M = 100
    real, parameter:: pi = 3.1415926535897932
    double precision   xedge(0 : M) , xcell(0 : M-1)
    double precision Uext(0 : M-1) 
    double precision Uold(0 : M-1)
    double precision Unew(0 : M-1)
    double precision:: t_final, time, dt, xa, xb, dx, cfl,a
  
    cfl = 1.0d0
    t_final = 1.0d0 
    time = 0.0d0
    a = 1.0d0
  
    xa = 0.0d0 ; xb = 1.0d0
    dx = (xb - xa)/M
    dt =  cfl * (dx /dabs(a))
    do i = 0, M-1 
        xedge(i) = xa + i*dx
        xcell(i) = xa + (i+1./2.)*dx
    enddo
        xedge(M) = xa + M*dx
        !print *, "dx =",dx,dt,xa,xb 
  
    do i=0,M-1
         Uold(i) = [-dcos(2.0d0 * pi * xedge(i+1) )
   &amp;            + dcos(2.0d0 * pi * xedge(i) )]/(2.0d0 * pi * dx)
         Uext(i) = dsin(2.0d0 * pi * (xedge(i)-a*time) )
         !write(11,*)xcell(i),uold(i),uext(i),dabs(uext(i)- uold(i)) 
    enddo
  
    do while (time &lt;= t_final)
          time = time + dt
          do i = 1 , M-2
            Unew(i) = Uold(i) - dt*(Uold(i+1)-Uold(i-1)) / (2.0d0*dx)
   &amp;  + 2*dt*dt*( Uold(i+1) - 2*Uold(i) + Uold(i-1) ) / (2.0d0*dx*dx)
  
            Unew(0) = Uold(0) - dt*(Uold(1)-Uold(M-1)) / (2.0d0*dx)
   &amp;  + 2*dt*dt*( Uold(1) - 2*Uold(0) + Uold(M-1) ) / (2.0d0*dx*dx)
  
            Unew(M-1) = Unew(0)                
  
            Uext(i) = dsin(2.0d0 * pi * (xedge(i)-a*time) )
            Uext(0) = dsin(2.0d0 * pi * (xedge(0)-a*time) )
            Uext(M-1) = dsin(2.0d0 * pi * (xedge(M)-a*time) )
          enddo
          Uold = Unew
  
          !print*,"dt=",dt," time =",time
    enddo
  
    do i=0, M-1
        print*, Uext(i), Unew(i), dabs(Uext(i)- Unew(i))
       ! write(20,*)xedge(i), Uext(i), Unew(i), dabs(Uext(i)- Unew(i)) 
  
    enddo
  
    END 
  </code></pre>