MATLAB Function Reference | ![]() ![]() |
Syntax
[I,J] = ind2sub(siz
,IND) [I1,I2,I3,...,In] = ind2sub(siz
,IND)
Description
The ind2sub
command determines the equivalent subscript values corresponding to a single index into an array.
[I,J] = ind2sub(
returns the arrays siz
,IND)
I
and J
containing the equivalent row and column subscripts corresponding to the index matrix IND
for a matrix of size siz
.
For matrices, [I,J] = ind2sub(size(A),find(A>5))
returns the same values as [I,J] = find(A>5)
.
[I1,I2,I3,...,In] = ind2sub(
returns siz
,IND)
n
subscript arrays I1
,I2
,..,In
containing the equivalent multidimensional array subscripts equivalent to IND
for an array of size siz
.
Examples
The mapping from linear indexes to subscript equivalents for a 2-by-2-by-2 array is:
See Also
![]() | ind2rgb | Inf | ![]() |