n class="keyword">for</span> d = 1:D
0073     Xoff = X(:,valid) + repmat(offsets, [1,T-2*mx]);
0074     aligned(:,:,d) = interp2(X,Y,waveforms(:,:,d), Xoff, Y(:,valid), <span class="string">'linear'</span>);
0075 <span class="keyword">end</span>
0076 
0077 
0078 <span class="comment">%%%%% The following code demonstrates the near-but-not-quite similar</span>
0079 <span class="comment">%%%%% effects of shifting a and comparing to b vs shifting b and comparing</span>
0080 <span class="comment">%%%%% to a.  Wh