I would like to vectorize the following Octave code:
A = 1:100;
B = [20 40 60];
C = zeros(3,11);
for i = B,
C(i,:) = A( (B(i) - 10) : B(i) );
end
Which extracts sub-arrays starting at specific indexes from a longer array.
I tried:
C = A(B - 10,B);
But this only returns the first sub-array.
Thanks