LoadError: MethodError: no method matching size(::Type{Float64})
Closest candidates are:
size{N}(::Any, !Matched::Integer, !Matched::Integer, !Matched::Integer...) at abstractarray.jl:48
size(!Matched::BitArray{1}) at bitarray.jl:39
size(!Matched::BitArray{1}, !Matched::Any) at bitarray.jl:43
...
while loading in broadcast_shape(::Type{T}, ::Array{SubString{String},1}) at broadcast.jl:31
in broadcast_t(::Function, ::Type{Any}, ::Type{T}, ::Vararg{Any,N}) at broadcast.jl:213
in broadcast(::Function, ::Type{T}, ::Array{SubString{String},1}) at broadcast.jl:230
in include_string(::String, ::String) at loading.jl:441
in include_string(::String, ::String) at sys.dylib:?
in include_string(::Module, ::String, ::String) at eval.jl:34
in (::Atom.##59#62{String,String})() at eval.jl:73
in withpath(::Atom.##59#62{String,String}, ::String) at utils.jl:30
in withpath(::Function, ::String) at eval.jl:38
in macro expansion at eval.jl:71 [inlined]
in (::Atom.##58#61{Dict{String,Any}})() at task.jl:60
To get it fixed I had to do:
coordx = parse.(coordx)
which now is : Vector{Real}
To clarify @yuyichao’s answer, you are getting an error because you are using Julia 0.5. The dot-call (broadcast) functionality is greatly improved in Julia 0.6. You should almost certainly upgrade if you can.
Note also that coordx = parse.(Float64,coordx) is not type-stable because it changes the type of coordx. In general, it is a good habit to not change the type of a variable in your code, because it will hurt performance (if you do it in performance-critical code). It probably doesn’t matter for you here, but it is a good habit to use a new variable name if you change the type.
It’s also a lot easier to debug your code by the tried-and-true cut-and-paste-in-REPL method if you avoid reusing variable names. Don’t worry about creating too many variables in function bodies because compilers are very good at figuring out when something will never be used again and not actually keeping it around.
The first example I saw on some blogs about using parse uses a number of type int there and it works. It somehow makes me think I can just pass a 1. then julia will figure out it’s a Float64.