| MATLAB Function Reference | Search  Help Desk |
| sub2ind | Examples See Also |
IND = sub2ind(Thesiz,I,J) IND = sub2ind(siz,I1,I2,...,In)
sub2ind command determines the equivalent single index corresponding to a set of subscript values.
IND = sub2ind(siz,I,J)
returns the linear index equivalent to the row and column subscripts in the arrays I and J for an matrix of size siz.
IND = sub2ind(siz,I1,I2,...,In)
returns the linear index equivalent to the n subscripts in the arrays I1,I2,...,In for an array of size siz.
The mapping from subscripts to linear index equivalents for a 2-by-2-by-2 array is:
ind2sub Subscripts from linear index
find Find indices and values of nonzero elements