Emulates the MATLAB function sub2ind.

sub2ind(dims, indices)

## Arguments

dims vector of dimensions of object to index into. vector of n-dimensional indices.