Programming Previous page   Next Page

Handling Subscripted Assignment

The use of a subscript or field designator with an object on the left-hand side of an assignment statement is known as a subscripted assignment. MATLAB calls a method named subsasgn in these situations. Object subscripted assignment can be of three forms - an array index, a cell array index, and a structure field name.

Each of these results in a call to subsasgn of the form

The first argument, A, is the object being referenced. The second argument, S, has the same fields as those used with subsref. The third argument, B, is the new value.

Examples of the subsasgn Method

See the following sections for examples of the subsasgn method:


Previous page  Handling Subscripted Reference Object Indexing Within Methods Next page

© 1994-2005 The MathWorks, Inc.