# ArgumentError: invalid index: 1.0 of type Float64

**URL:** <https://discourse.julialang.org/t/argumenterror-invalid-index-1-0-of-type-float64/81862>\
**Category:** General Usage\
**Created:** [May 29, 2022, 11:50am UTC](https://discourse.julialang.org/t/argumenterror-invalid-index-1-0-of-type-float64/81862 "2022-05-29T11:50:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kip0d](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@kip0d](https://discourse.julialang.org/u/kip0d)\
**Post date:** [May 29, 2022, 11:50am UTC](https://discourse.julialang.org/t/argumenterror-invalid-index-1-0-of-type-float64/81862/1 "2022-05-29T11:50:08Z")

</div>

Hi all,  
I get that error when I’m trying to run this code:

```julia
filename="channelABCD_2021-12-31_10-20-45.wav"
y,Fs = wavread(filename)
Y=y[1:3.6e7,2]

```

**ERROR: ArgumentError: invalid index: 1.0 of type Float64**

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [May 29, 2022, 12:04pm UTC](https://discourse.julialang.org/t/argumenterror-invalid-index-1-0-of-type-float64/81862/2 "2022-05-29T12:04:12Z")

</div>

Assuming `y` is a 2 dimensional array, you are trying to get the components using an index range of floating point numbers rather than integers (because `3.6e7` is a Float64, the whole index range is converted to a list of Float64 numbers, starting with 1.0 and not the integer 1).  
I believe you can fix this by using `1:(36x10^6)` instead.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [May 29, 2022, 1:25pm UTC](https://discourse.julialang.org/t/argumenterror-invalid-index-1-0-of-type-float64/81862/3 "2022-05-29T13:25:53Z")

</div>

> [@jd-foster](#):
>
> I believe you can fix this by using `1:(36x10^6)` instead.

I think you mean `1:(36*10^6)`? (Interestingly enough, you can make `1:(36x10^6)` work if you define `x10 = 10`.)

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [May 29, 2022, 11:51pm UTC](https://discourse.julialang.org/t/argumenterror-invalid-index-1-0-of-type-float64/81862/4 "2022-05-29T23:51:02Z")

</div>

Good catch (probably shouldn’t type code on a phone.)
