This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Convert object to array index


ind = subsindex(A)


MATLAB® calls subsindex to convert an object into an integer index. Define a subsindex method for your class if you want to use objects of the class as array indices.

ind = subsindex(A) called by MATLAB for the expression X(A) when A is an object. MATLAB does not call subsindex if the indexing expression results in a call to an overloaded subsref or subsasgn method for the class of X. subsindex must return the value of the object as a zero-based integer index. ind must contain integer values in the range 0 to prod(size(X))-1.

MATLAB invokes subsindex separately on all the subscripts in an expression, such as X(A,B).

Extended Capabilities

Introduced before R2006a