MethodError: no method matching getindex (::Float64, ::Colon)

Hi Guys
I’m newbie in Julia. I’m trying to run some .jl scripts files that I downloaded from Bitbucket. I’m currently using Julia 0.6.4 and Atom 1.29 versions.
I think that the codes haven’t been updated and maybe this is the reason for the error.
TestAircraft.jl is the script,I’m trying to execute and the two other scripts mentioned:
MethodError: no method matching getindex (::Float64, ::Colon)
In anonymous at base/
In macro expansion at TestAircraft.jl:47
In ACDynamics at AircraftDynamics.jl:115
In GenCoeff at Aerodynamics.jl:37

Below there are the lines error mentioned above:

a) TestAircraft.jl
line error 47:
dX = ACDynamics(GTM, x, u, ud, Wind)

b) AircraftDynamics.jl has a function ACDynamics called on TestAircraft.jl
line error 115:
C = GenCoeff(Aircraft, α, β, pt, qt, rt, δₑ, δₐ, δᵣ)

c) Aerodynamics.jl has a function GenCoeff called on Test Aircraft.jl
line error 37
C = [C_D[:];C_E[:];C_L[:];C_l[:];C_m[:];C_n[:];C_X[:];C_Y[:];C_Z[:]]

Can somebody help me to fix these errors. I’m completely lost about what do do.thanks

Marcelo

That error is saying that you’re trying to index (getindex) a floating point number (Float64) by a :, like:

julia> 1.5[:]
ERROR: MethodError: no method matching getindex(::Float64, ::Colon)

That’s trying to slice a number as though it were an array. I don’t think we ever supported such a thing, but if you’re jumping a large number of versions since the code was originally written Julia might be returning “scalars” — numbers that aren’t inside an array — in cases where it used to return arrays.

1 Like

This line

C = [C_D[:];C_E[:];C_L[:];C_l[:];C_m[:];C_n[:];C_X[:];C_Y[:];C_Z[:]] is the culprit.

In v0.5, transpose times vector itself results in a one element vector but in v0.6 it is just the number.
So, all C_* are different types in v0.5 vs v0.6+. You can omit [:] in all this variables now.

Thanks. It worked.My script ran well.