title: Error in calculating 3-D to 2-D matrix in matlab
body: <p>I need to create 2-D <code>[spacextime]</code> matrix from the given 3D matrix (<code>latxlonxtime</code>) where </p>
  
  <pre><code>if lat=m and lon=n 
  then space=(mxn)
  </code></pre>
  
  <p>But I am having the error like this:</p>
  
  <blockquote>
    <p>Error using horzcat. Dimensions of matrices being concatenated are not
    consistent</p>
  </blockquote>
  
  <p>I did:</p>
  
  <pre><code>lon1= permute(lon,[2,1]);
  Z = reshape(Zwinter, [(lat*lon1) 356]);
  </code></pre>
  
  <p>I also tried without <code>permute lon</code> which gives the error "Inner matrix dimensions must agree".<br>
   I am a new matlab-user and could not figure it out.<br>
  Thanks in advance!</p>