Is there a way to obtain multiple components from a ComponentArray
?
something like
using ComponentArrays
ca = ComponentArray(x1 = [1, 2], x2 = [10, 20], x3 = [100, 200])
ca[:x1, :x3]
# would return (ca.x1, ca.x2)
Is there a way to obtain multiple components from a ComponentArray
?
something like
using ComponentArrays
ca = ComponentArray(x1 = [1, 2], x2 = [10, 20], x3 = [100, 200])
ca[:x1, :x3]
# would return (ca.x1, ca.x2)
You can do
julia> getindex.(Ref(ca), (:x1, :x3))
([1, 2], [100, 200])
It is in work, but it’s a somewhat tough problem for reasons I mention here. Until I get it figured out, broadcasting getproperty
or getindex
like @dpsanders did is the way to go.