VSHIFT Cycles the elements of an array along a specified dimension. Y=VSHIFT(X,N,DIM) cycles the elements of X N places along dimension DIM. Example: x=[1 2 3 4 5]; vshift(x,+1,2)=[2 3 4 5 1] vshift(x,-1,2)=[5 1 2 3 4] Note shifting by N and then by -N recovers the original array. [Y1,Y2,...YN]=VSHIFT(X1,X2,...XN,N,DIM) also works. VSHIFT(X1,X2,...XN,N,DIM); with no arguments overwrite the original input variables. Note that VSHIFT is similar to Matlab's CIRCSHIFT, but has the opposite convection for positive and negative shifts. ------------------------------------------------------------------ Y=VSHIFT(X,N,DIM,INDEX,DIM2) applies this shift selectively, only to that subset of X obtained by indexing X with INDEX along DIM2, i.e. 1 2 DIM2 DIMS(X) | | | | X(:,:, ... INDEX, ..., :) is cycled N places along dimension DIM, but the remainder of X is not. DIM and DIM2 cannot be the same. The above extensions to multiple output varibles work in this case as well. ------------------------------------------------------------------ See also: VINDEX, CIRCSHIFT. __________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2001--2016 J.M. Lilly --- type 'help jlab_license' for details