Emulates the MATLAB function sub2ind.
sub2ind
sub2ind(dims, indices)
dims
vector of dimensions of object to index into.
indices
vector of n-dimensional indices.