Main Content


Class: matlab.mixin.indexing.RedefinesDot
Namespace: matlab.mixin.indexing

Determine number of values to return from customized indexing operations beginning with dots

Since R2021b


n = dotListLength(obj,indexOp,indexContext)


n = dotListLength(obj,indexOp,indexContext) determines the number of values to return from customized indexing operations that begin with dots and that reference or assign to comma-separated lists. Operations that begin with dot indexing and end with dot or brace indexing produce comma-separated lists, such as [C{:}] = obj{1:3} and [obj{1}.prop{1:3}] = B{:}. The indexOp object contains the indices being changed, and indexContext identifies whether the reference is used in a statement, as a list of arguments to a function, or in an assignment operation.

Input Arguments

expand all

Object that implements customized dot indexing by inheriting from matlab.mixin.indexing.RedefinesDot.

Types of indexing operations and indices referenced, specified as an array of IndexingOperation objects. For a dot reference, the first object in the array has a Type property of Dot.

Context in which the indexing operation occurs, specified as one of these enumeration members:

  • matlab.indexing.IndexingContext.Statement — Indexed reference used as a statement (for example, obj.a)

  • matlab.indexing.IndexingContext.Expression — Indexed reference used as an argument to a function (for example, func(obj.a))

  • matlab.indexing.IndexingContext.Assignment — Indexed assignment (for example, [obj.a] = deal(x)).

Output Arguments

expand all

Number of values to return from an indexing operation, specified as a nonnegative integer.



To learn about attributes of methods, see Method Attributes.


For an example of a scalar struct class that implements custom dot indexing, see matlab.mixin.indexing.RedefinesDot.

Version History

Introduced in R2021b