Main Content


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

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Thread-Based Environment
Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.

Version History

Introduced before R2006a