# ERROR: LoadError: MethodError: no method matching setindex\_shape\_check(::Int64, ::Int64, ::Int64)

**URL:** <https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-setindex-shape-check-int64-int64-int64/18249>\
**Category:** General Usage\
**Created:** [December 3, 2018, 2:26pm UTC](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-setindex-shape-check-int64-int64-int64/18249 "2018-12-03T14:26:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![muriloasouza](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/muriloasouza/32/4650_2.png) [@muriloasouza](https://discourse.julialang.org/u/muriloasouza)\
**Post date:** [December 3, 2018, 2:26pm UTC](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-setindex-shape-check-int64-int64-int64/18249/1 "2018-12-03T14:26:04Z")

</div>

Hello, using Julia 1.0.1, and i’m getting this error:

```julia
ERROR: LoadError: MethodError: no method matching setindex_shape_check(::Int64, ::Int64, ::Int64)
Closest candidates are:
  setindex_shape_check(::AbstractArray{#s57,1} where #s57, ::Integer, ::Integer) at indices.jl:221
  setindex_shape_check(::AbstractArray{#s57,2} where #s57, ::Integer, ::Integer) at indices.jl:225
  setindex_shape_check(::AbstractArray, ::Integer...) at indices.jl:179
  ...
Stacktrace:
 [1] macro expansion at .\multidimensional.jl:641 [inlined]
 [2] _unsafe_setindex!(::IndexLinear, ::Array{Float64,2}, ::Int64, ::Base.Slice{Base.OneTo{Int64}},
::Int64) at .\multidimensional.jl:636
 [3] _setindex! at .\multidimensional.jl:631 [inlined]
 [4] setindex!(::Array{Float64,2}, ::Int64, ::Function, ::Int64) at .\abstractarray.jl:998
 [5] top-level scope at C:\Users\Muril\Desktop\Murilo\UFPE\Dissertação\Julia\Arquivos Feitos 1.0.1\f
luxo_harm.jl:279 [inlined]
 [6] top-level scope at .\none:0
 [7] include_string(::Module, ::String, ::String) at .\loading.jl:1005
 [8] (::getfield(Atom, Symbol("##128#133")){String,String,Module})() at C:\Users\Muril\.julia\packag
es\Atom\Fha1N\src\eval.jl:120
 [9] withpath(::getfield(Atom, Symbol("##128#133")){String,String,Module}, ::String) at C:\Users\Mur
il\.julia\packages\CodeTools\hB4Hy\src\utils.jl:30
 [10] withpath at C:\Users\Muril\.julia\packages\Atom\Fha1N\src\eval.jl:46 [inlined]
 [11] #127 at C:\Users\Muril\.julia\packages\Atom\Fha1N\src\eval.jl:117 [inlined]
 [12] hideprompt(::getfield(Atom, Symbol("##127#132")){String,String,Module}) at C:\Users\Muril\.jul
ia\packages\Atom\Fha1N\src\repl.jl:84
 [13] macro expansion at C:\Users\Muril\.julia\packages\Atom\Fha1N\src\eval.jl:116 [inlined]
 [14] (::getfield(Atom, Symbol("##126#131")){Dict{String,Any}})() at .\task.jl:85
in expression starting at C:\Users\Muril\Desktop\Murilo\UFPE\Dissertação\Julia\Arquivos Feitos 1.0.1
\fluxo_harm.jl:193

```

It says it starts at line 193? If thats so, here it is:

```julia

if length(pos3) > 0 || length(posI) > 0
    if length(pos3) > 0
    println("text 1:\n\n", pos3, "\n")
    else
    println("text 2.\n")
    end
    if length(posI) > 0
    println("text 3:\n\n", posI, "\n")
    else
    println("text 4.\n")
    end
    println("text 5.\n")
    println("text 6.\n")

    
    barra_filtro = [2]; 
    hs = [13]; 
    Xcf = zeros(Nt);
    Cf = zeros(Nt);
    Xlf = zeros(Nt);
    Lf = zeros(Nt);
    ws = zeros(Nt);
    Xf = zeros(Nt);
    Rf = zeros(Nt);
    y5 = zeros(ComplexF64,Nt,hmax);

for h = 3:2:hmax
    for m = 1:length(barra_filtro)
        for i = 1:Nt
            if i == barra_filtro[m]
             Xcf[i] = u[i]^2/(kj*Qmod); 
             Cf[i] = 1/(2*pi*f*Xcf[i]); 
             Xlf[i] = Xcf[i]/(hs[m]^2); 
             Lf[i] = Xlf[i]/(2*pi*f); 
             ws[i] = 1/sqrt(Cf[i]*Lf[i]); 
             Xf[i] = ws[i]*Lf[i]; 
             Rf[i] = Xf[i]/fq; 
             y5[i,h] = 1/(Rf[i]+im*(h*Xlf[i]-Xcf[i]/h));
            end
        end
    end
end

    

    Yh_filtro = zeros(ComplexF64,Nt,Nt,hmax);
    for h = 3:2:hmax
      for L = 1:Nt
        for C = 1:Nt
          for i = 1:Nt 
            if L == C && (de[i] == L || para[i] == L)
                if i == L
                     Yh_filtro[L,C,h] = Yh_filtro[L,C,h]+y1[i,h]+y2[i,h]+y3[i,h]+y5[i,h];
                end
                if i != L
                    Yh_filtro[L,C,h] = Yh_filtro[L,C,h]+y1[i,h];
                end
            end
            if L != C && (de[i] == L && para[i] == C)
                     Yh_filtro[L,C,h] = Yh_filtro[L,C,h]-y1[i,h];
                     Yh_filtro[C,L,h] = Yh_filtro[L,C,h];
            end
          end
        end
      end
    end

    
    Vh_filtro = zeros(ComplexF64,Nt,hmax);
    for h = 3:2:hmax 
           Vh_filtro[:,h] = Yh_filtro[:,:,h]\Ih[:,h];
    end

    DHIv_filtro = zeros(Nt,hmax);
    for h = 3:2:hmax
        for i = 1:Nt
          DHIv_filtro[i,h] = abs(Vh_filtro[i,h])/u[i]*100;
        end
    end

    DHIv_filtro[:,1] = 1;

   

    DHTv3_filtro = zeros(Nt,1); 
    DHTvI_filtro = zeros(Nt,1); 
    for i = 1:Nt 
        DHTvaux3_filtro = 0;
        DHTvauxI_filtro = 0;
        for h = 3:2:hmax 
            if rem(h,3) == 0
                DHTvaux3_filtro = DHTvaux3_filtro + abs(Vh_filtro[i,h])^2;
            else
                DHTvauxI_filtro = DHTvauxI_filtro + abs(Vh_filtro[i,h])^2;
            end
        end
    DHTv3_filtro[i] = sqrt.(DHTvaux3_filtro)/u[i]*100;
    DHTvI_filtro[i] = sqrt.(DHTvauxI_filtro)/u[i]*100;
    end
else
    println("text 7.\n")
end

display(groupedbar([DHTvI DHTvI_filtro], group = barras, xlabel = "B", ylabel = "DHT3 (%)", title = "title", bar_position = :dodge, bar_width=0.7))

```

The code was working fine in 0.6, i’m trying to adapt it to 1.0.1, but i have no idea what this error means and how to fix it.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [December 3, 2018, 2:28pm UTC](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-setindex-shape-check-int64-int64-int64/18249/2 "2018-12-03T14:28:47Z")

</div>

Use 0.7 for updating code from 0.6 - it’ll tell you about deprecations.

> [@PSA: use Julia 0.7 if you are upgrading](https://discourse.julialang.org/t/psa-use-julia-0-7-if-you-are-upgrading/13321):
>
> A lot of people are posting issues where their old code doesn’t work anymore on 1.0 because some function has been renamed or removed. The 0.7 release exists exactly for this reason: your old code will work on 0.7 and give you a specific warning about how to fix your code. If you have any old code, you should use 0.7 to get these warnings before switching to 1.0; even if you just have work habits that may need changing, you should probably use 0.7 for a while. If someone posts an issue like thi…

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [December 3, 2018, 2:36pm UTC](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-setindex-shape-check-int64-int64-int64/18249/3 "2018-12-03T14:36:21Z")

</div>

Maybe this is helpful: The error comes from something like:

```julia
julia> A = zeros(2, 2);

julia> A[:,1] = 4
ERROR: MethodError: no method matching setindex_shape_check(::Int64, ::Int64, ::Int64)

```

e.g. you try to assign a scalar to multiple locations in `A`. This should be written with broadcasting in Julia 1.0:

```julia
julia> A = zeros(2, 2);

julia> A[:,1] .= 4
2-element view(::Array{Float64,2}, :, 1) with eltype Float64:
 4.0
 4.0

```

---

<div class="post-metadata">

**Author:** ![muriloasouza](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/muriloasouza/32/4650_2.png) [@muriloasouza](https://discourse.julialang.org/u/muriloasouza)\
**Post date:** [December 3, 2018, 2:43pm UTC](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-setindex-shape-check-int64-int64-int64/18249/4 "2018-12-03T14:43:31Z")

</div>

Yes, i changed back to 0.7 and got the info that broadcasting would fix the problem, thanks guys!
