【发布时间】:2019-07-08 22:59:29
【问题描述】:
我基本上想取一个诸如“Array{Float64,1}[1,2,3]”之类的字符串,然后把它变成一个实际的数组:[1,2,3]
我已经尝试过 convert 函数,但是 julia 不喜欢将东西转换为数组。
convert(Array,x)
julia 拒绝了这个,说它不能将字符串转换成数组。
ERROR: MethodError: Cannot `convert` an object of type String to an object of type Array
Closest candidates are:
convert(::Type{Array}, ::DataStructures.CircularBuffer{T}) where T at /Users/benjaminkhoury/.julia/packages/DataStructures/5F6tJ/src/circular_buffer.jl:172
convert(::Type{T<:Array}, ::AbstractArray) where T<:Array at array.jl:474
convert(::Type{T<:AbstractArray}, ::T<:AbstractArray) where T<:AbstractArray at abstractarray.jl:14
...
Stacktrace:
[1] top-level scope at none:0
【问题讨论】:
标签: type-conversion julia