subsindex - Convert object to array index - MATLAB (original) (raw)
Main Content
Convert object to array index
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. 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
The subsindex
function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced before R2006a