I have a question about indexing.
a=randi(9,5)
[b i]=sort(a)
c=a(i)
I would think that c should be the same as b, but it is not.
The index array i has all the correct information in it as can be seen with
for k=1:columns(a)
w(:,k)=a(i(:,k),k);
endfor
now b-w is equal to 0
Is there some technical reason that if you try and use the index array
i on an matrix
of the same dimensions, that it can't work?
I would think that it should apply each col of the i to a in a(i)
as I did in the loop.
I know it can be vectorized:
a(sub2ind (size(a), i, repmat(1:4, rows(a), 1)))
a(i+(0:columns(a)-1)*rows(a))
but I just think that octave should be smart enough to just do a(i)