Arrays, Matrix, append!

One thing I think is nice to mention is that, in Julia, you can write explicitly what you want using simple definitions and loops, and obtain an efficient code. In this case, you could have done, for example (after using push!):

X = zeros(length(X_l),length(X_l[1]))
for i in 1:length(X_l)
  for j in 1:length(X_l[i])
    X[i,j] = X_l[i][j]
  end
end
println(size(X))
@show X

This less compact, but many times it is easier to write your own small function than to search for a library to do what you want (this code can be made shorter in several ways, depending on the familiarity you have with the Julia syntax).

2 Likes