我正在尝试在朱莉娅制作一个3D点矢量,我现在将其作为矢量本身.但是,我无法弄清楚如何将这些向量转换为向量.我重现错误的最小例子是:
foo = rand(3) #Vector Float64, 3
bar = Vector{Float64}[] #Vector Array{Float64,1} 0
append!(bar,foo) #Throws an error
Run Code Online (Sandbox Code Playgroud)
这会在最后一行抛出错误
`convert` has no method matching convert(::Type{Array{Float64,1}}, ::Float64)
in copy! at abstractarray.jl:197
in append! at array.jl:478
in include_string at loading.jl:97
in include_string at C:\Users\Alex\.julia\v0.3\Jewel\src\eval.jl:36
in anonymous at C:\Users\Alex\.julia\v0.3\Jewel\src\LightTable\eval.jl:68
in handlecmd at C:\Users\Alex\.julia\v0.3\Jewel\src\LightTable/LightTable.jl:65
in handlenext at C:\Users\Alex\.julia\v0.3\Jewel\src\LightTable/LightTable.jl:81
in server at C:\Users\Alex\.julia\v0.3\Jewel\src\LightTable/LightTable.jl:22
in server at C:\Users\Alex\.julia\v0.3\Jewel\src\Jewel.jl:18
in include at boot.jl:245
in include_from_node1 at loading.jl:128
in process_options at client.jl:285
in _start at client.jl:354
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点,或者我错过了阻止这种结构的东西?我应该使用矩阵吗?我没有到目前为止,因为我想迭代点,而不是批量转换它们.
julia ×1