So I'm struggling on what I think should be a pretty straightforward operation.
I understand that in Julia if I wanted to concatenate 2 2D arrays I could do this
# 10x3 Matrix
a = rand(10, 3)
b = rand(10, 3)
c = rand(10, 3)
# 30x3 Matrix
c = [a ; b; c]
# 30x3 Matrix
d = vcat(a,b,c)
But I don't know how to generalize this to a generator format What I want to do is this :
multi_2d = [rand(10,3) for _ in 1:3]
matrix = vcat(multi_2d)
But I am left with a 3 element array that I can't seem to reshape.
Would love any guidance on this
You can use the splat operator ...
to apply the function vcat
to the sequence of arrays in multi_2d
:
vcat(multi_2d...)