@QUANG_VU_NGUY_N_PH_M wrote:
struct A{T} time::Vector{Float64} data::Vector{T} end
I would like to initialize an empty object of class A
I tried with outer constructor as below
A() = A([],[])
But it failed:
julia> a = A() ERROR: MethodError: no method matching A(::Array{Any,1}, ::Array{Any,1}) Closest candidates are: A(::Array{Float64,1}, ::Array{T,1}) where T at none:3 Stacktrace: [1] A() at .\none:1 [2] top-level scope at none:0
Thus, I tried to find out how to initialized
A() = A(Array{Float64}[],[])
This is also failed
julia> a = A() ERROR: MethodError: no method matching A(::Array{Array{Float64,N} where N,1}, ::Array{Any,1}) Closest candidates are: A(::Array{Float64,1}, ::Array{T,1}) where T at none:3 Stacktrace: [1] A() at .\none:1 [2] top-level scope at none:0
How should we initialized an emtpy vector of Float64 type?
Posts: 5
Participants: 3