Shift matrix

Fast and convenient function for shifting a matrix in 2D.
622 Downloads
Updated 30 Nov 2011

View License

The code uses array indexing to implement shifting of the matrix. It is about 2.5 times faster than using interp2 with 'nearest neighbor' option for shifting of the matrices. Inspiration for optimized array indexing comes from a snippet on circular shift in: "MATLAB array manipulations tips and tricks" guide by Peter J. Acklam (http://home.online.no/~pjacklam).

Cite As

Shalin Mehta (2024). Shift matrix (https://www.mathworks.com/matlabcentral/fileexchange/31840-shift-matrix), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Creating and Concatenating Matrices in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

Updated help.

1.0.0.0