title: Storing values of a loop in matrix using R
body: <p>A have the following matrices</p>
  
  <pre><code>w= 
      0.0  0.0  0.0  0.3  0.4
      0.1  0.0  0.5  0.2  0.0
      0.0  0.3  0.0  0.0  0.0
      0.0  0.0  0.6  0.0  0.0
      0.0  0.0  0.0  0.5  0.0
  c=
      0.1  0.0  0.00   0.0   0.00
      0.0  0.4  0.00   0.0   0.00
      0.0  0.0  0.25   0.0   0.00
      0.0  0.0  0.00   0.2   0.00
      0.0  0.0  0.00   0.0   0.05
  
  x = seq(1, 1, length=5)
  result = matrix()
  </code></pre>
  
  <p>I built a loop in R.:</p>
  
  <pre><code>nloop=10
  for (i in 1:nloop)
  {
      u=x %*% t(w) 
  
      x=(x %*% t(w))+((u) %*% t(c))
  
      x=1/(1+exp(x))
  
      result=matrix(nrow=10 , ncol = 5)
      for (i in 1:10)
      {
          result[[i]] =x 
      }
  }
  </code></pre>
  
  <p>R returns this error:</p>
  
  <blockquote>
    <p>Error in result[[i]] = x :    more elements supplied than there are
    to replace</p>
  </blockquote>
  
  <p>I want to store the values of each loop in <code>result</code> matrix</p>