myTEOcircshift.m 489 B

123456789101112131415161718192021222324
  1. function X = myTEOcircshift(Y,k)
  2. %circshift without the boundary behaviour...
  3. colshift = k(1);
  4. rowshift = k(2);
  5. temp = circshift(Y,k);
  6. if colshift < 0
  7. temp(end+colshift+1:end,:) = flipud(Y(end+colshift+1:end,:));
  8. elseif colshift > 0
  9. temp(1:1+colshift-1,:) = flipud(Y(1:1+colshift-1,:));
  10. else
  11. end
  12. if rowshift<0
  13. temp(:,end+rowshift+1:end) = fliplr(Y(:,end+rowshift+1:end));
  14. elseif rowshift>0
  15. temp(:,1:1+rowshift-1) = fliplr(Y(:,1:1+rowshift-1));
  16. else
  17. end
  18. X = temp;