JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.61k stars 5.48k forks source link

Can you please explain this error in julia function? #19520

Closed rahulmankare closed 7 years ago

rahulmankare commented 7 years ago

it shows error in line shows in bold text, the error is-

LoadError: MethodError: no method matching Array{Float64,N}(::Float64, ::Float64)
Closest candidates are:
  Array{Float64,N}{T}(::Any) at sysimg.jl:53
 while loading C:\Users\admin\Desktop\new julia program\runit1.jl, in expression starting on line 302
function search_roots(kz,win)
omr_lo=win[1];
  omr_hi=win[2];
  omi_lo=win[3];
  omi_hi=win[4];
  N=win[5];
  omr=omr_lo:(omr_hi-omr_lo)/N:omr_hi;
  omi=omi_lo:(omi_hi-omi_lo)/N:omi_hi;
  X=meshgridx(omr,omi);
  Y=meshgridy(omr,omi);
  zi=X+im*Y;
  **Z=zeros(N+1,N+1);**
  Z_curv=zeros(N+1,N+1);
  for ii=1:N+1
      for jj=1:N+1
      Z[ii,jj]=disp_bwo(kz,zi[ii,jj]);
      Z_curv[ii,jj]=abs(Z[ii,jj]);
      end
  end
KristofferC commented 7 years ago

N is a Float64 but should be an Int if you want to use the zeros function like you are.

Please redirect further questions to the discussion forum: https://discourse.julialang.org/

rahulmankare commented 7 years ago

N is a float64 value but getting same error again and again.

On 7 December 2016 at 13:13, Kristoffer Carlsson notifications@github.com wrote:

N is a Float64 but should be an Int if you want to use the zeros function.

Please redirect further questions to the discussion forum: discourse.julialang.org

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JuliaLang/julia/issues/19520#issuecomment-265378491, or mute the thread https://github.com/notifications/unsubscribe-auth/AXS_M34NR199_5YrBHvbYJe-YSvIHBHIks5rFmO1gaJpZM4LGSAR .

rahulmankare commented 7 years ago

ok fine