Ok yes, thanks for your answer. it helped me tackling this problem.

Actually, the problem was residing in the bad writing of the optional 
arguments. I was passing "standard" float numbers to variables defined as 
Arrays{Float64,N}...

The proper definition of this function is:

    function gaussianarea(Amplitude::Array{Float64},HWHM::Array{Float64}; 
eseAmplitude::Array{Float64} = [0.0], eseHWHM::Array{Float64} = [0.0])

Thanks again, I've been scratching my head on this problem!

Le jeudi 12 mai 2016 21:24:47 UTC+10, Gunnar Farnebäck a écrit :
>
> Your problem is probably that you try to call your function with four 
> positional arguments, although the last two should have been named. Compare
>
> julia> f(x, y; z=0) = x + y + z
> f (generic function with 1 method)
>
> julia> f(2, 3)
> 5
>
> julia> f(2, 3, 4)
> ERROR: MethodError: `f` has no method matching f(::Int64, ::Int64, ::Int64)
> Closest candidates are:
>   f(::Any, ::Any)
>
> julia> f(2, 3, z = 4)
> 9
>
> Den torsdag 12 maj 2016 kl. 12:51:13 UTC+2 skrev Charles Ll:
>>
>> Dear all,
>>
>> There is something I did not understood well in Julia regarding the type 
>> fo the variables and this creates difficulties with the functions I am 
>> writing.
>>
>> For one of the functions of Spectra.jl package, I wrote for instance: 
>>
>> function gaussianarea(Amplitude::Array{Float64},HWHM::Array{Float64}; 
>> eseAmplitude::Array{Float64} = 0, eseHWHM::Array{Float64} = 0)
>>
>> I was thinking that using the ::Array{Float64} will allow users to enter 
>> either vectors or arrays. However, when I try to enter a vectors for 
>> Amplitude or HWHM for instance, I get the following error:
>>
>> LoadError: MethodError: `gaussianarea` has no method matching 
>> gaussianarea(::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, 
>> ::Array{Float64,1})
>> Closest candidates are:
>>   gaussianarea(::Array{Float64,N}, ::Array{Float64,N})
>> while loading In[46], in expression starting on line 9
>>
>>
>> I'm quite disappointed by that and don't know how to avoid it... Because 
>> for me a vector is an Array {Float64,1}... But the above message says no?
>>
>> What did I miss here? 
>>
>

Reply via email to