我正在尝试将两个一维数组堆叠在一列中。
a = [] #1D array
b = [] #1D array
c = reshape(a, b, 1) # I am expecting it to put array 'b' under array 'a'
我可以知道这是在 Julia 中堆叠数组的正确语法和方法吗?
最佳答案
这是你想要的吗?
julia> a = [1, 2]
2-element Array{Int64,1}:
1
2
julia> b = [3, 4]
2-element Array{Int64,1}:
3
4
julia> vcat(a, b)
4-element Array{Int64,1}:
1
2
3
4
julia> [a; b] # the same as vcat but with a shorter syntax
4-element Array{Int64,1}:
1
2
3
4
另请参阅https://docs.julialang.org/en/v1/manual/arrays/#man-array-concatenation .
关于arrays - 在 Julia 中按列堆叠数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65494879/