Multiple simultaneous different assignments with set #13
Labels
No labels
bug
duplicate
enhancement/documentation
enhancement/feature
enhancement/organization
question
rejected
upstream
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
UserCurt/mpath#13
Loading…
Reference in a new issue
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?
Normal usage of
mpath.setis to assign a singular value to the location pointed to by one or more paths. This feature request is to generalize this to allow setting not a singular value but multiple values simultaneously. The details are yet to be determined, but the current idea is to provide a named argument likeMultiSetthat, when true, will require the value to be a cell array, the size of the resolution of the mpath to be compatible with the size of the cell array, and will take each mpath pointer after resolution and assign it to the corresponding value in the cell array. For example:The cell array is nominally identical in size to the resolution of the mpath. Having dimensions of the cell array be singular would implicitly expand this dimension so repeated assignments of the same value can be done. For example:
As an alternative to the named argument, the comma separated list feature could be used as mentioned here. This would be somewhat similar to how comma separated lists are used in MATLAB. For example:
However, the main disadvantage of this is the shape would be less obvious and perhaps even confusing when
#listis used multiple times possibly along with theOutputDims(orListDims) named argument.As an aside, this feature request is different issue #14 which effectively incorporates
mpath.getin withmpath.getduring multiple assignment.Not discussed in the original issue post, but one closely related consideration is allowing assignment of not only fields but also elements of arrays when used in conjunction with parenthesis or brace notation in #5. For example,
S = struct(A=[1 2; 3 4]); R = mpath.set(S, "/A(1,:#2)", {5, 6})would returnR = [5 6; 3 4]. Though it is unclear if the:here should not be iterated over but directly assigned, in which case it would be a single assignment usingR = mpath.set(S, "/A(1,:)", [5, 6]). This may only be applicable when the last operation in the mpath expression is parenthesis or brace.Completed by commit
977b9d3. The proposedMultiSetbehavior has been superseded byUniformValues=false. A cell value grid must match the resolved target grid, and each cell is assigned to its corresponding target coordinate.UniformPathscontrols whether input pointers form one combined target grid or separate groups. The proposed#listsyntax is not needed for this behavior.Singleton expansion of value grids remains separate and is tracked by #44.