Code covered by the BSD License  

Highlights from
Shift matrix

Be the first to rate this file! 7 Downloads (last 30 days) File Size: 13.17 KB File ID: #31840
image thumbnail

Shift matrix

by Shalin Mehta

 

17 Jun 2011 (Updated 30 Nov 2011)

Fast and convenient function for shifting a matrix in 2D.

| Watch this File

File Information
Description

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).

MATLAB release MATLAB 7.11 (2010b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
30 Nov 2011

Updated help.

Tag Activity for this File
Tag Applied By Date/Time
shift Shalin Mehta 17 Jun 2011 09:50:43
matrix manipulation Shalin Mehta 17 Jun 2011 09:50:43
interp2 Shalin Mehta 17 Jun 2011 09:50:43
circular shift Shalin Mehta 17 Jun 2011 09:50:43

Contact us at files@mathworks.com