Julia: Transforming an Array of Arrays in a 2-dimensional Array Julia: Transforming an Array of Arrays in a 2-dimensional Array arrays arrays

Julia: Transforming an Array of Arrays in a 2-dimensional Array


hcat(d...) and vcat(d...) should do what you want.


If your array of array is supposed to represent a matrix and you want to preserve the logic, then this is the simpler I found (julia 1.1)

julia> a=[ [1,2], [3,4], [5,6] ]3-element Array{Array{Int64,1},1}: [1, 2] [3, 4] [5, 6]julia> permutedims(reshape(hcat(a...), (length(a[1]), length(a))))3×2 Array{Int64,2}: 1  2 3  4 5  6

One could use transpose instead of permutedims.