title: R matlab package: why is repmat inconsistent?
body: <p>I have got a question regarding the matlab package for R. Here's what I get</p>
  
  <pre><code>library(matlab)
  a = matrix(1:4,2,2)
  repmat(a,3,1)
       [,1] [,2]
  [1,]    1    2
  [2,]    3    4
  [3,]    1    2
  [4,]    3    4
  [5,]    1    2
  [6,]    3    4
  </code></pre>
  
  <p>this is what I expect. replicate a three times along the first dimension. but</p>
  
  <pre><code>b = matrix(1:6,2,3)
  b
      [,1] [,2] [,3]
  [1,]    1    3    5
  [2,]    2    4    6
  
  repmat(b,3,1)
        [,1] [,2]
  [1,]    1    2
  [2,]    3    4
  [3,]    5    6
  [4,]    1    2
  [5,]    3    4
  [6,]    5    6
  [7,]    1    2
  [8,]    3    4
  [9,]    5    6
  </code></pre>
  
  <p>this is not consistent. I want a 6 by 3 matrix as the one obtained by </p>
  
  <pre><code>rbind(b,rbind(b,b))
       [,1] [,2] [,3]
  [1,]    1    3    5
  [2,]    2    4    6
  [3,]    1    3    5
  [4,]    2    4    6
  [5,]    1    3    5
  [6,]    2    4    6
  </code></pre>