Skip to content

Can't index component array with shaped components with subset of keys #256

@marius311

Description

@marius311

Would be convenient if this worked and returned a new ComponentArray with just the x and y components, ComponentArrays 0.15.11:

julia> using ComponentArrays

julia> c = ComponentVector(x=rand(2,2), y=rand(3), z=4)
ComponentVector{Float64}(x = [0.08932677188438709 0.2039248385682888; 0.7932786495449815 0.9448910346464564], y = [0.8857236834484066, 0.3657104827001233, 0.7234530317203763], z = 4.0)

julia> c[[:x,:y]]
ERROR: MethodError: no method matching _maybe_view_axis(::UnitRange{Int64}, ::ShapedAxis{(2, 2)})

Fwiw this works with scalar components eg if c = ComponentVector(x=2, y=3, z=4)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions