Hello everyone! I’m a mechanical engineer coming from MATLAB and relatively new to Julia, so I’m really sorry for my heresies!
I’m currently working on mutable structures, and I’m interested in creating an array (or vector?) of structures like the following:
mutable struct s3_str
c::Int64
d::Float64
s3() = new(0,0.)
end
mutable struct s2_str
a::Int64
b::Array{Int64,1}
s3 #I would like to have a vector field of s3 structures here
s2() = new(0, [0], s3()) # is it right?
end
mutable struct s1
s2 #I would like to have a vector field of s2 structures here
s1() = new(s2()) # is it right?
end
that I would like to call like:
s1[i].b = some array of integers
s1[i].s2[j].c = some integer
Could you please tell me:
- how to define the fields of the structs
- how to preallocate the array of structures s1[ - ] of length n, containing the array of structures s2[ - ] of length m with zero-ed (or undefined) values.
Thank you all in advance, and I hope you are all healthy!