在我试图调试和解决的一些代码中,我遇到了我的下一个障碍。
ERROR: LoadError: MethodError: no method matching Array(::Type{Int64}, ::Int64)
Closest candidates are:
Array(::LinearAlgebra.UniformScaling, ::Integer, ::Integer) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\LinearAlgebra\src\uniformscaling.jl:345我查看了提供的材料,它看起来数组定义可能已经更改为使用arr或Array{Int64,0} ...但这些似乎对我也不起作用。有什么建议吗?提前谢谢你!
# Puts the output of one lineup into a format that will be used later
if status==:Optimal
data_lineup_copy = Array(Int64, 0)
for i=1:num_data
if getValue(data_lineup[i]) >= 0.9 && getValue(data_lineup[i]) <= 1.1
data_lineup_copy = vcat(data_lineup_copy, fill(1,1))
else
data_lineup_copy = vcat(data_lineup_copy, fill(0,1))
end
end
for i=1:num_shot
if getValue(shot_lineup[i]) >= 0.9 && getValue(shot_lineup[i]) <= 1.1
data_lineup_copy = vcat(data_lineup_copy, fill(1,1))
else
data_lineup_copy = vcat(data_lineup_copy, fill(0,1))
end
end
return(data_lineup_copy)
end
end
data1 = Array(Int64, 0)
data2 = Array(Int64, 0)
data3 = Array(Int64, 0)发布于 2019-06-07 03:48:52
Array(Int64, 0)会在旧版本(可能是0.6版本之前)上创建一个空的Int64 1D数组(即Vector)。
现在,要创建一个空的Int64 1D数组,您可以使用以下任一命令
data1 = Array{Int64, 1}(undef, 0) # where `1`, the second type parameter is for the dimension
data1 = Array{Int64}(undef, 0)
data1 = Vector{Int64}(undef, 0)
data1 = Vector{Int64}()
data1 = Int64[]您可以随时参考官方文档,了解Julia中array construction的不同方式。
https://stackoverflow.com/questions/56483786
复制相似问题