如何在Julia中将元素附加到二维数组?我尝试使用push!
test = [1 2; 3 4]
push!(test, [8 9])
但是我遇到了以下错误
ERROR: MethodError: no method matching push!(::Array{Int64,2}, ::Array{Int64,2})
Closest candidates are:
push!(::Any, ::Any, ::Any) at abstractarray.jl:2158
push!(::Any, ::Any, ::Any, ::Any...) at abstractarray.jl:2159
push!(::Array{Any,1}, ::Any) at array.jl:920
...
Stacktrace:
[1] top-level scope at none:0
谢谢!
答案 0 :(得分:2)
您可以通过串联其他行来实现。
test = [1 2; 3 4]
vcat(test, [8 9])