Main Content


Class: matlab.mixin.indexing.RedefinesParen
Namespace: matlab.mixin.indexing

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

Since R2021b


n = parenListLength(obj,indexOp,indexContext)


n = parenListLength(obj,indexOp,indexContext) determines the number of values to return from customized indexing operations that reference or assign to comma-separated lists. Operations that begin with parentheses indexing and end with dot or brace indexing produce comma-separated lists, such as [C{:}] = obj(idx).prop and [obj(idx).prop{:}] = B{:}. The IndexingOperation 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 parentheses indexing by inheriting from matlab.mixin.indexing.RedefinesParen.

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

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 = 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 a general framework that shows how to implement customized parentheses indexing, see matlab.mixin.indexing.RedefinesParen. For a runnable example of a mapping class that implements custom parentheses indexing, see Customize Parentheses Indexing for Mapping Class.

Version History

Introduced in R2021b