% change to waveforms shifts instead of template shifts</span>
0064 offsets(offsets &gt; mx) = mx;   offsets(offsets &lt; -mx) = -mx;  <span class="comment">% clip to maxshift</span>
0065 
0066 
0067 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%% Realign waveforms %%%%%%%%%%%%%%%%%%%%%%%%%%</span>
0068 <span class="keyword">if</span> (nargout &lt; 2),  <span class="keyword">return</span>;  <span class="keyword">end</span>;
0069 
0070 [X,Y] = meshgrid(1:T, 1:N);
0071 aligned = zeros(N, T-2*mx, D);
0072 <spa