sub2ind
Converts subscript to a linear index. From dimensions x and index i,j.
Syntax
ind = sub2ind(dim,i,j)
Inputs
- dim
- Matrix dimensions.
- i,j
- 2-dimensional indices.
Outputs
- ind
- Linear index.
Example
Simple sub2ind example.
sub2ind([2,4;5,2],2,5)
ans = 10