title: loop through element of meshgrid matlab
body: <p>I am trying to loop through a meshgrid to create a matrix of vectors. If I have: </p>
  
  <pre><code>[x,y] = meshgrid(1:2,1:2)
  </code></pre>
  
  <p>can someone explain looping through each element to get a matrix which equals:</p>
  
  <pre><code>matrix =
   [x(1,1) y(1,1)] [x(1,2) y(1,2)]
   [x(2,1) y(2,1)] [x(2,2) y(2,2)]
  </code></pre>
  
  <p>thanks in advance</p>