ind2sub
Returns subscript from the linear index ind.
Syntax
[i,j]=ind2sub(dim, ind)
Inputs
- dim
- Matrix dimensions.
- ind
- Linear index.
Outputs
- i,j
- 2-dimensional indices.
Example
Simple ind2sub example:
[i,j]=ind2sub([4,5], 7)
i = 3
j = 2