How to convert Vector{Array{T,N}} to Array{T,N+1}

Maybe this:

julia> vec_of_arr = fill(rand(3,4,5),6);

julia> arr = cat(vec_of_arr...,dims=4);

julia> size(arr)
(3, 4, 5, 6)

You can use permutedims(arr, (4,1,2,3)) to move the last axis to first position in indexing.

Check the documentation for cat and permutedims for more information.

1 Like