# MethodError: no method matching -(::NTuple{4,Int64}, ::Int64)

**URL:** <https://discourse.julialang.org/t/methoderror-no-method-matching-ntuple-4-int64-int64/30817>\
**Category:** New to Julia\
**Created:** [November 7, 2019, 4:30am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-ntuple-4-int64-int64/30817 "2019-11-07T04:30:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marinarrd](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@marinarrd](https://discourse.julialang.org/u/marinarrd)\
**Post date:** [November 7, 2019, 4:30am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-ntuple-4-int64-int64/30817/1 "2019-11-07T04:30:40Z")

</div>

I am new and dont understand why this doesnt work!

```julia
original_cost = npzread("file.npy")
size_cost = size(original_cost)
println('size of original table',size_cost)
left_index = 40
right_index = size_cost - left_index
println(left_index, right_index)
cost = copy(original_cost)
cost=cost[left_index:right_index,left_index:right_index,left_index:right_index,left_index:right_index]

```

with output

```julia
size of original table(101, 101, 101, 101)
MethodError: no method matching -(::NTuple{4,Int64}, ::Int64)
Closest candidates are:
  -(!Matched::Complex{Bool}, ::Real) at complex.jl:299
  -(!Matched::Missing, ::Number) at missing.jl:94
  -(!Matched::Base.CoreLogging.LogLevel, ::Integer) at logging.jl:107
  ...

Stacktrace:
 [1] top-level scope at In[9]:5

```

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [November 7, 2019, 4:40am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-ntuple-4-int64-int64/30817/2 "2019-11-07T04:40:36Z")

</div>

Hey there! `size` returns a tuple, not a number. Hence, when you try to substract a number from it you get an error. You might want to use `size(original_cost, 1)` instead, assuming that the extent in every dimension is the same.

---

<div class="post-metadata">

**Author:** ![marinarrd](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@marinarrd](https://discourse.julialang.org/u/marinarrd)\
**Post date:** [November 7, 2019, 4:43am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-ntuple-4-int64-int64/30817/3 "2019-11-07T04:43:43Z")

</div>

ahh yes, thanks! 🙂

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [November 7, 2019, 4:44am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-ntuple-4-int64-int64/30817/4 "2019-11-07T04:44:05Z")

</div>

You’re welcome!
