">% have positive sign, since we're about to treat them as 'mass'</span>
0074 waves = spikes.waveforms;
0075 waves(~isThreshLo, :) = waves(~isThreshLo, :) - spikes.threshV(2);
0076 waves( isThreshLo, :) = spikes.threshV(1) - waves( isThreshLo, :);
0077 waves = waves .* mask;
0078 
0079 <span class="comment">% now COM is straightforward</span>
0080 fiducials = (waves * (1:numsamples)') ./ sum(waves, 2);
0081 
0082 clear mask waves;  <span class="comment">% manual garbage collection</span>
0083 
0084 <span cl