Hello,
I am very new to Julia and am running into this error. Operations with similar code have not returned this error so Im not sure what I’m doing wrong. I run the following code and get the can’t convert error. Any advice is appreciated.
mutable struct Results
r:: Float64
w:: Float64
b:: Float64
pol_func:: Array{Float64,3}
val_func:: Array{Float64,3}
#asset_func:: Array{Float64,3}
lab_func:: Array{Float64,3}
age_j:: Int64
mu:: Array{Float64,2}
K:: Float64
L:: Float64
#K::Array{Float64,1}
#L::Array{Float74,1}
end
function Initialize()
prim = Primitives()
pol_func = zeros(prim.na,prim.nz,prim.N)
val_func = zeros(prim.na,prim.nz,prim.N)
lab_func = zeros(prim.na,prim.nz,prim.N)
r = 0.05
w = 1.05
b = 0.2
age_j = 66
mu = zeros(prim.na,prim.nz,prim.N)
K = 3
L = 0.5
res = Results(pol_func,val_func, lab_func,age_j, mu, r,w,b, K, L)
prim, res
end
prim, res = Initialize()
MethodError: Cannot `convert` an object of type Array{Float64, 3} to an object of type Float64
Closest candidates are:
convert(::Type{T}, !Matched::Gray24) where T<:Real at C:\Users\mcket\.julia\packages\ColorTypes\1dGw6\src\conversions.jl:114
convert(::Type{T}, !Matched::Gray) where T<:Real at C:\Users\mcket\.julia\packages\ColorTypes\1dGw6\src\conversions.jl:113
convert(::Type{T}, !Matched::T) where T<:Number at C:\Users\mcket\AppData\Local\Programs\Julia-1.7.3\share\julia\base\number.jl:6
...
Results(r::Array{Float64, 3}, w::Array{Float64, 3}, b::Array{Float64, 3}, pol_func::Int64, val_func::Array{Float64, 3}, lab_func::Float64, age_j::Float64, mu::Float64, K::Int64, L::Float64) at pset3_code.jl:45
Initialize() at pset3_code.jl:72
top-level scope at pset3_code.jl:150
eval at boot.jl:373 [inlined]