Matlab code for spike sorting