Transform between Linear Index and Matrix Indices
idx_trafo.RdThese functions are as in MATLAB.
ind2sub() transforms a linear index to a row and column index for a matrix of given size.
sub2ind() transforms a matrix index, (row, col) to a a linear index (in terms of columns).
Arguments
- dim
Integer vector of size 2. Matrix dimensions.
- ind
Integer. Linear index.
- row
Integer. Row index.
- col
Integer. Column index.