const B = Array{Mean_covar,1}(undef, 10) works well because Array’s are mutable.
Input:
mutable struct Mean_covar
mu::Array{Float64,2}
sigma::Array{Float64,2}
w::Float64
end
const B = Array{Mean_covar,1}(undef, 5)
display(B)
Output:
5-element Vector{Mean_covar}:
#undef
#undef
#undef
#undef
#undef
Input:
B[1] = Mean_covar(zeros(2,2), zeros(2,2), 0.0)
display(B)
Output:
5-element Vector{Mean_covar}:
Mean_covar([0.0 0.0; 0.0 0.0], [0.0 0.0; 0.0 0.0], 0.0)
#undef
#undef
#undef
#undef