Customize Object Indexing - MATLAB & Simulink (original) (raw)

Main Content

Customize indexed reference and assignment for your class

Customize indexed reference and assignment behavior for objects. User-defined classes possess the same indexing behavior as built-in MATLABĀ® classes, but you can modify this behavior by inheriting from one or more superclasses.

Modular indexing mixin classes enable you to customize indexing operations individually. For example, you can customize parentheses indexing by inheriting frommatlab.mixin.indexing.RedefinesParen, while using the default MATLAB behavior for dot and brace indexing without writing additional code.

You can also overload the subsref andsubsasgn functions in your classes, but this technique requires you to overload parentheses, dot, and brace indexing, even if you need to customize only one behavior. Using the modular indexing classes is the recommended procedure whenever possible.

Classes

Functions

Topics