As the tittle suggests I am wondering if it is possible to circshift the columns of an array with a different shiftsize in each column without using a for loop.
I want to do this
without a loop. Is it possible?
No products are associated with this question.
Where is Anrei's answer??? It was here before 2 minutes ago.
Is an answer deleted after accepting a previous one?
I had some question on it that why?
He proposed this:
[m,n] = size(a); out = a(bsxfun(@plus,toeplitz(1:m,[1,m-(0:n-2)]),(0:n-1)*m));
Apart from the fact that its hardcore, my question would be what would be the case if the shiftindex was not linear..
shiftindex=[2 2 10 5];
Play games and win prizes!Learn more