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

**URL:** <https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-float64-colon/12950>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [August 6, 2018, 5:03pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-float64-colon/12950 "2018-08-06T17:03:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcelord12](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@marcelord12](https://discourse.julialang.org/u/marcelord12)\
**Post date:** [August 6, 2018, 5:03pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-float64-colon/12950/1 "2018-08-06T17:03:22Z")

</div>

Hi Guys  
I’m newbie in Julia. I’m trying to run some .jl scripts files that I downloaded from [Bitbucket](https://bitbucket.org/sweewarman/thesis/src/master/). 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

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [August 6, 2018, 5:27pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-float64-colon/12950/2 "2018-08-06T17:27:05Z")

</div>

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

```julia
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.

---

<div class="post-metadata">

**Author:** ![tomaklutfu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomaklutfu/32/2411_2.png) [@tomaklutfu](https://discourse.julialang.org/u/tomaklutfu)\
**Post date:** [August 6, 2018, 5:30pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-float64-colon/12950/3 "2018-08-06T17:30:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marcelord12](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@marcelord12](https://discourse.julialang.org/u/marcelord12)\
**Post date:** [August 6, 2018, 6:31pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-float64-colon/12950/4 "2018-08-06T18:31:56Z")

</div>

Thanks. It worked.My script ran well.
