dim = 1;   pp.breaks = (1:(pp.pieces+1));
0138 
0139 <span class="comment">% Change resample indices to correspond to the strung-together piecewise polynomial.</span>
0140 offset = ((1:numspikes) - 1)' * numsamples;
0141 resample_inds = resample_inds + repmat(offset, [1, numsamples]);
0142 
0143 <span class="comment">% OK, finally.  Do the resample &amp; clip the invalid regions</span>
0144 resampled = ppval(pp, resample_inds);
0145 spikes.waveforms = resampled(:, left_valid:right_valid);
0146 
0147 <span c