How do retrieve all vectors as from an array of vectors

Hello everyone.

Basically, I have an array of vectors like this:

 a  = [ [5, 3, 2], [5, 3, 5], [8, 4, 6] ]

which looks like this:

3-element Array{Array{Int64,1},1}:
 [5, 3, 2]
 [5, 3, 5]
 [8, 4, 6]

I want to retrieve all the elements (vectors) such that it ends up looking like this:

b = [ [5 3 2]; [5 3 5]; [8 4 6] ]

3×3 Array{Int64,2}:
 5  3  2
 5  3  5
 8  4  6

How can I achieve this? Thanks in advance.

You can use vertical concatenation :

vcat(a'...) 
reduce(vcat, a')

Or horizontal and then transpose :

hcat(a...)' 

Or even a comprehension:

[a[i][j] for i=1:3, j=1:3]
1 Like

Perfect!