Inconsistent shape with repeated comma-separated list selector indices #36

Closed
opened 2026-07-11 10:40:56 +00:00 by UserCurt · 1 comment
UserCurt commented 2026-07-11 10:40:56 +00:00 (Migrated from codeberg.org)

Repeated indices in CSL selectors produce inconsistent shapes.

>> data = struct(a={10, 20});
>> result = mpath.resolve(data, "/a<1,2,1>", MissingPolicy="retain")

result =

  2x1 mpath array

    /a<1>
    /a<2>

The expected result is 3x1, each with the three respective CSL selector indices.

In contrast, having just the index 1 repeated gives the expected result:

>> result = mpath.resolve(data, "/a<1,1>", MissingPolicy="retain")

result =

  2x1 mpath array

    /a<1>
    /a<1>

>> result = mpath.resolve(data, "/a<2,2>", MissingPolicy="retain")

result = 

  mpath: /a<2>

The second case here would expect the same element but repeated as a 2x1.

Repeated indices in CSL selectors produce inconsistent shapes. ```matlab >> data = struct(a={10, 20}); >> result = mpath.resolve(data, "/a<1,2,1>", MissingPolicy="retain") result = 2x1 mpath array /a<1> /a<2> ``` The expected result is 3x1, each with the three respective CSL selector indices. In contrast, having just the index `1` repeated gives the expected result: ```matlab >> result = mpath.resolve(data, "/a<1,1>", MissingPolicy="retain") result = 2x1 mpath array /a<1> /a<1> >> result = mpath.resolve(data, "/a<2,2>", MissingPolicy="retain") result = mpath: /a<2> ``` The second case here would expect the same element but repeated as a 2x1.
UserCurt commented 2026-07-15 09:12:33 +00:00 (Migrated from codeberg.org)

Fixed in 5b0dbd.

Fixed in `5b0dbd`.
Sign in to join this conversation.
No description provided.