# MethodError: no method matching

**URL:** <https://discourse.julialang.org/t/methoderror-no-method-matching/22612>\
**Category:** New to Julia\
**Tags:** package\
**Created:** [April 1, 2019, 9:19pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching/22612 "2019-04-01T21:19:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aquaman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquaman/32/6586_2.png) [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Post date:** [April 1, 2019, 9:19pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching/22612/1 "2019-04-01T21:19:30Z")

</div>

Hi

I have tested a matrix operation in Julia:  
i.e.

```julia
test=zeros(Float64,6,4,4)

test[6,1:4,2:4] = 1.0

ERROR: MethodError: no method matching setindex_shape_check(::Float64, ::Int64, ::Int64, ::Int64)

```

The solution in Matlab:

```julia

val(:,:,1) =

     0 0 0 0
     0 0 0 0
     0 0 0 0
     0 0 0 0
     0 0 0 0
     0 0 0 0

val(:,:,2) =

     0 0 0 0
     0 0 0 0
     0 0 0 0
     0 0 0 0
     0 0 0 0
     1 1 1 1

val(:,:,3) =

     0 0 0 0
     0 0 0 0
     0 0 0 0
     0 0 0 0
     0 0 0 0
     1 1 1 1

val(:,:,4) =

     0 0 0 0
     0 0 0 0
     0 0 0 0
     0 0 0 0
     0 0 0 0
     1 1 1 1

```

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [April 1, 2019, 9:29pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching/22612/2 "2019-04-01T21:29:18Z")

</div>

You need `.=`, not just `=`. For more info, see: [Multi-dimensional Arrays · The Julia Language](https://docs.julialang.org/en/v1/manual/arrays/#Assignment-1)

---

<div class="post-metadata">

**Author:** ![Aquaman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquaman/32/6586_2.png) [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Post date:** [April 1, 2019, 9:31pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching/22612/3 "2019-04-01T21:31:54Z")

</div>

very nice! thank you!
