Skip to content

ind2sub

builtin · libnexusinterp/corefcn/sub2ind-proprietary.cc

: [row, col] = ind2sub (sz, ind)
: [I1, I2, …, In] = ind2sub (sz, ind)

Convert linear (column-major) indices into subscripts.

sz is a real vector of at least two elements and ind is a real array of linear indices. Each output has the size of ind and class double.

If fewer outputs than dimensions are requested, the last output absorbs the remaining dimensions; if more are requested, the extra outputs are all ones. A single output returns the linear indices themselves.