MATLAB Object-Oriented Programming

(Joyce) #1

Syntax for subsref, and subsasgn Methods


If a class overloads subsref to support either '{}', '.', or both types of indexing, and
the operation returns more than one value, overload subsref to return multiple values
using varargout:

function varargout = subsref(A,S)
...
end

If a class overloads subsasgn to support either '{}', '.', or both types of indexing, and
the operation assigns more than one value, overload subsasgn to accept multiple values
using varargin:

function A = subsagn(A,S,varargin)
...
end

See Also


More About



  • “Modify nargout and nargin for Indexing Methods” on page 17-9

  • “Comma-Separated Lists”


17 Specialize Object Behavior

Free download pdf