Functions That Control Indexing Style
If you have row-column subscripts but want to use linear indexing instead, you can convert to the latter using the
sub2ind function. In the 3-by-3 matrix
A used in the previous section,
sub2ind changes a standard row-column index of (3,2) to a linear index of
To get the row-column equivalent of a linear index, use the
|Linear Indexing||Accessing Multiple Elements|
© 1994-2005 The MathWorks, Inc.