DimensionalData question

How do I specify a DimArray over a subset of a dimension?
I thought this would work but it gives an error.

Ddim = Dim{:Ddim}(['a','b','c'])

DimArray(  1:2,  Ddim(['a','b']) )

Create the full array first and index into it.

Ddim = Dim{:Ddim}(['a','b','c'])

arr = DimArray(1:3, Ddim)

subarr = arr[At(['a','b'])]

I’d like to concatenate several arrays. Something like:

cat( [
        DimArray(  1:2,  Ddim(['a','b']) ),
        DimArray(  3:4,  Ddim(['c','d']) ),
        DimArray(  5:6,  Ddim(['e','f']) )
      ]... ,

dims= :Ddim )
vcat(
    DimArray(1:2, Dim{:Ddim}(['a','b'])),
    DimArray(3:4, Dim{:Ddim}(['c','d'])),
    DimArray(5:6, Dim{:Ddim}(['e','f']))
)

I think this works.

when a dimension is out of order then the dimension elements get dropped on concatenation

cat(

    DimArray([1 2;3 4], ( Dim{:Ddim}(['a','d']), Dim{:Adim}(['x','y']) ) ),
    DimArray([5 6;7 8], ( Dim{:Ddim}(['b','c']), Dim{:Adim}(['x','y']) ) ),

    dims=:Ddim )

I think it works if the Dimension in the initial Dim arrays are also unordered

To avoid XY problems, maybe give a little more code for context and reasons why you want to do this.