Indexing confusion

Michael Grossbach michael at grossbach.org
Thu May 1 09:39:35 CDT 2008


Assume a matrix
X = [1, 2; 3, 4];
To produce, say, the second element of the first row one would issue
X(1,2)
ans = 2
To obtain all combinations of elements in X I then use
fullfact(size(X))
ans =
    1   1
    1   2
    2   1
    2   2

To my confusion,
X(fullfact(size(X)))

produces
ans =
    1   1
    1   3
    3   1
    3   3

instead of the expected
ans =
    1
    2
    3
    4
Is this intended behaviour and am I missing something?

Using Octave 3.0 on Windows Vista.

Michael


More information about the Help-octave mailing list