cshift(M,d): Circularly shifts rows, columns, pages,... of a vector, matrix or
hypermatrix M.
* Any subset of M's dimensions may be shifted through a single call to
cshift().
* M can be of any unmixed data type
* cshift() cannot be used with cells.
To get help and examples, type: -->cshift // with no argument
EXAMPLES:
-->M = grand(3,4,"uin",0,9)
M =
2. 4. 8. 0.
1. 1. 5. 1.
0. 9. 2. 8.
-->cshift(M,1) // Shifts rows down by 1
ans =
0. 9. 2. 8.
2. 4. 8. 0.
1. 1. 5. 1.
-->cshift(M,-1) // Shifts rows up by 1
ans =
1. 1. 5. 1.
0. 9. 2. 8.
2. 4. 8. 0.
-->cshift(M,[0 -1]) // Shifts columns left by 1
ans =
4. 8. 0. 2.
1. 5. 1. 1.
9. 2. 8. 0.
-->cshift(M,[0 2]) // Shifts columns right by 2
ans =
8. 0. 2. 4.
5. 1. 1. 1.
2. 8. 0. 9.
-->cshift(M,[1 2]) // Shifts rows down by 1, and columns right by 2
ans =
2. 8. 0. 9.
8. 0. 2. 4.
5. 1. 1. 1.