Function: m = idxmatrix (sz)

Create matrix of subindexes

Create a matrix with each element correspoding to its subindex in the matrix, i.e.

    m(i,j,k) = i * 100 + j * 10 + k = ijk

The input sz defines the size of the matrix.

Example:


M = idxmatrix ([2 3 2])
ans(:,:,1) =

  111   121   131
  211   221   231

ans(:,:,2) =

  112   122   132
  212   222   232

See also: sub2ind.

Package: miscellaneous