I have a rank two array, and would like to use slices to index it. If I create the slices in place, I get the expected result:
A = rand(3,3)
assert(allclose(A[0:3, 0:3], A))
On the other hand, if I create the slices in advance, indexing does not behave as expected (at least from the perspective of an octave/matlab user, where both methods produce the same result):
A = rand(3,3)
i = range(0,3)
j = range(0,3)
assert(allclose(A[i, j], A))
# AssertionError
Why do these methods produce different results?