Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

subsindex

Convert object to array index

Syntax

ind = subsindex(A)

Description

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).

Introduced before R2006a

Was this topic helpful?