op = nelson.indexing.IndexingOperation(type, indices)
op = nelson.indexing.IndexingOperation(type, indices, name)
| Parameter | Description |
|---|---|
| type | a nelson.indexing.IndexingOperationType, or its name as a char/string ('Paren', 'Brace', 'Dot', ...). |
| indices | cell array of the paren/brace subscripts (empty for a dot operation). |
| name | the field name (dot operation only). |
| Parameter | Description |
|---|---|
| op | a scalar nelson.indexing.IndexingOperation. |
nelson.indexing.IndexingOperation describes one indexing operation. It is passed to the parenReference/parenAssign, braceReference/braceAssign and dotReference/dotAssign methods of classes that derive from nelson.mixin.indexing.Redefines*. A chained expression is passed as a 1×N array of operations (one per level of the chain), so indexOp can be scalar or an array.
Properties: Type (a nelson.indexing.IndexingOperationType), Indices (cell array of the subscripts, for Paren/Brace) and Name (the field name, for Dot).
An IndexingOperation (scalar or array) can be applied to any value with the dynamic form value.(indexOp), which performs the corresponding subsref (read) or subsasgn (write) chain. This is the recommended way to forward the received chain from a hook, for example obj.Data.(indexOp).
op = nelson.indexing.IndexingOperation('Paren', {2});
char(op.Type)
op.Indices{1}
data = struct('f', {[1 2 3], [4 5 6 7]});
chain = [nelson.indexing.IndexingOperation('Paren', {2}), ...
nelson.indexing.IndexingOperation('Dot', {}, 'f')];
data.(chain) % same as data(2).f
| Version | Description |
|---|---|
| 2.0.0 | initial version |