function i=c2i(c) global m n dims = repmat(m,[1 n]); i = coord2ind(c+1,dims); return