Manipulating Arrays
reshape
shiftdim
shiftdim allows one to do generalised tranposition. If A is a matrix then shiftdim(A,1) is equal to A'. In fact the 1 can be any odd number; since transposition is of order 2 an even number will leave A unchanged.
>> A=reshape(1:12,3,4) A = 1 4 7 10 2 5 8 11 3 6 9 12 >> shiftdim(A,3) ans = 1 2 3 4 5 6 7 8 9 10 11 12 >> shiftdim(A,6) ans = 1 4 7 10 2 5 8 11 3 6 9 12
circshift
Useful links
http://www-h.eng.cam.ac.uk/help/tpl/programs/Matlab/faster_scripts.html
http://www-h.eng.cam.ac.uk/help/tpl/programs/Matlab/tricks.htm