Hi so I am currently trying to create a structure I have included a condensed version of my structure that I am trying to create. The issue is that when I try and set the values of the fields in the structure they are all overwritten with the last value that I have set to the structure and I was wondering how I could stop this.
MAXBD=5
mutable struct BODYSTRUCTURE
BODYNAME::String # Units: 'nd', Desc: 'Body Name'
end
mutable struct MULTIBODYSTRUCTURE
BD::Array{BODYSTRUCTURE,1}
end
bd = BODYSTRUCTURE(
" ",
)
M = MULTIBODYSTRUCTURE(
fill(bd, (MAXBD)),
)
M.BD[1].BODYNAME="first"
M.BD[2].BODYNAME="second"
This produces the following:
julia> M.BD[2].BODYNAME
"second"
julia> M.BD[1].BODYNAME
"second"
Instead of the desired:
julia> M.BD[2].BODYNAME
"first"
julia> M.BD[1].BODYNAME
"second"
I would greatly appreciate any assistance with this problem.