How to Search continuous matrix values that matches continuous values in the same matrix?

How to search continuous matrix values that matches continuous values in the same matrix? For example,
a=[4;3;5;2;5;6;1;2;3;4;5;2,6,7,8,5,1,2,3,4,5,7,4,6,3,3]
Here the answer should be
ans=[0;0;0;0;0;0;1,2,3,4,5,0,0,0,0,0,1,2,3,4,5,0,0,0,0,0]
Help me to find the answer for matrix of size Nx1. I want to use this to detect whether a portion of the image is copied and pasted on the same image.

Answers (1)

You don't want to use the answer that probably most people would/will give - something probably using find() or ismember(). A more robust way is to use normxcorr2() in the Image Processing Toolbox. Here is a link to the last time I posted my demo on it: http://www.mathworks.com/matlabcentral/answers/60258#answer_72787

Asked:

on 15 Feb 2013

Community Treasure Hunt

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

Start Hunting!