title: How to construct a matrix in Julia sequentially?
body: <p>I need to construct a matrix in Julia by appending rows. The idea is this:</p>
  
  <pre><code>mat = []     # initialize empty mat
  for i = 1:5
      x, y = f(i), g(i)    # here f and g are previously defined functions
      mat = [mat; [x y]]
  end
  </code></pre>
  
  <p>This doesn't work, I get an error:</p>
  
  <blockquote>
    <p>ERROR: DimensionMismatch("mismatch in dimension 2 (expected 2 got 1)")</p>
  </blockquote>
  
  <p>in the line where I try to append to <code>mat</code>. I am new to Julia. How can I accomplish what I want?</p>