Integrate with NamedArray #23

Open
opened 2025-10-13 22:51:39 +00:00 by UserCurt · 0 comments
UserCurt commented 2025-10-13 22:51:39 +00:00 (Migrated from codeberg.org)

When calling resolve or get, most dimensions will be associated with a set of fields, with each row/column/page/etc having a corresponding field name. This issue proposed integration with NamedArray (no repository yet) so that these individual row/column/page/etc can be accessed through the field name itself.

An example without integration:

>> S = struct(A=struct(X=1, Y=2), B=struct(X=3, Y=4));

>> G = mpath.get(S, "/{A,B}/{X,Y}");
>> N = NamedArray(G, ["A", "B"], ["X", "Y"])

N = 

       X    Y
       
  A    1    2
  B    3    4

The same example with integration with a proposed approach using the named argument NamedArrayDims:

>> N = mpath.get(S, "/{A,B}/{X,Y}", NamedArrayDims="all");

Dimension associated with parenthesis and brace indexing operations #5 cannot have an associated name.

Alternative to introducing a named argument to mpath.get, a new function mpath.NamedArray(...) can be used as mentioned in #15.

When calling `resolve` or `get`, most dimensions will be associated with a set of fields, with each row/column/page/etc having a corresponding field name. This issue proposed integration with NamedArray (no repository yet) so that these individual row/column/page/etc can be accessed through the field name itself. An example without integration: ```matlab >> S = struct(A=struct(X=1, Y=2), B=struct(X=3, Y=4)); >> G = mpath.get(S, "/{A,B}/{X,Y}"); >> N = NamedArray(G, ["A", "B"], ["X", "Y"]) N = X Y A 1 2 B 3 4 ``` The same example with integration with a proposed approach using the named argument `NamedArrayDims`: ```matlab >> N = mpath.get(S, "/{A,B}/{X,Y}", NamedArrayDims="all"); ``` Dimension associated with parenthesis and brace indexing operations #5 cannot have an associated name. Alternative to introducing a named argument to `mpath.get`, a new function `mpath.NamedArray(...)` can be used as mentioned in #15.
Sign in to join this conversation.
No description provided.