Anyone has an idea to do template matching by using matlab?

Code:
c = normxcorr2(sub_onion(:,:,1),sub_peppers(:,:,1));
% offset found by correlation
[max_c, imax] = max(abs(c(:)));
[ypeak, xpeak] = ind2sub(size(c),imax(1));
corr_offset = [(xpeak-size(sub_onion,2)) 
               (ypeak-size(sub_onion,1))];

% relative offset of position of subimages
rect_offset = [(rect_peppers(1)-rect_onion(1)) 
               (rect_peppers(2)-rect_onion(2))];

% total offset
offset = corr_offset + rect_offset;
xoffset = offset(1);
yoffset = offset(2);
This is part of code that i digged from matlab website. I just can't understand when dealing with (1) and (2) like "rect_peppers(1)" because i was using C programming before this.
In C, before correlation, affine transform is needed for template matching. Is it included in normxcorr2 function?
Anyone knows how to program template matching by using matlab?
Please help. Thank you very much.

Best regards,
Tommy