1
0
Fork
You've already forked mpath
0

Unmatched dimensions can combine without error in some circumstances #24

Open
opened 2025年10月14日 01:00:11 +02:00 by UserCurt · 0 comments

If matching multiple fields of various sizes, the sizes can mesh in such a way that the result could be valid. This behavior is inconsistent depending on the orientation of the mismatch.

>> S = struct(A=1, B=2, C=3, D=[4 5 6]);
>> mpath.get(S, ["/A", "/B", "/C"; "/D", missing, missing])
Error using cat
Dimensions of arrays being concatenated are not consistent.
Error in mpath.external.catcell (line 87)
 Rnew{index} = cat(d, R{ind{:}});
 ^^^^^^^^^^^^^^^^^
Error in mpath.Pointer/get (line 148)
 result = mpath.external.catcell(result,'all');
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in mpath.get (line 66)
 result = mp.get(data, varargin{:});
 ^^^^^^^^^^^^^^^^^^^^^^^^^
>> S = struct(A=1, B=2, C=3, D=[4;5;6]);
>> mpath.get(S, ["/A", missing; "/B", missing; "/C", "/D"])
ans =
 1 4
 2 5
 3 6

Expected behavior is to get an error in both cases from incompatible sizes.

This is an upstream bug with catcell (no repository currently).

If matching multiple fields of various sizes, the sizes can mesh in such a way that the result could be valid. This behavior is inconsistent depending on the orientation of the mismatch. ```matlab >> S = struct(A=1, B=2, C=3, D=[4 5 6]); >> mpath.get(S, ["/A", "/B", "/C"; "/D", missing, missing]) Error using cat Dimensions of arrays being concatenated are not consistent. Error in mpath.external.catcell (line 87) Rnew{index} = cat(d, R{ind{:}}); ^^^^^^^^^^^^^^^^^ Error in mpath.Pointer/get (line 148) result = mpath.external.catcell(result,'all'); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in mpath.get (line 66) result = mp.get(data, varargin{:}); ^^^^^^^^^^^^^^^^^^^^^^^^^ ``` ```matlab >> S = struct(A=1, B=2, C=3, D=[4;5;6]); >> mpath.get(S, ["/A", missing; "/B", missing; "/C", "/D"]) ans = 1 4 2 5 3 6 ``` Expected behavior is to get an error in both cases from incompatible sizes. This is an upstream bug with `catcell` (no repository currently).
Sign in to join this conversation.
No Branch/Tag specified
main
dev
functional
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
UserCurt/mpath#24
Reference in a new issue
UserCurt/mpath
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?