% x1 = loadspk('trouble22467_12DIV_nodrug_01.spk');
% x2 = loadspk('trouble22467_13DIV_40uM-CNQX_01.spk');
% 
% time = [x1.time; x2.time+max(x1.time)];
% channel = [x1.channel; x2.channel];
% unit = [x1.unit; x2.unit];
% waveform = [x1.waveform x2.waveform];
% threshold = [x1.threshold; x2.threshold];
% timestamps = [max(x1.time) max(x2.time)+max(x1.time)];
% 
% save trouble22467_waveforms_12-14DIV time channel unit timestamps waveform threshold;
% 
% %% No manipulation of spikes
% clear all;
% spkdat = load('trouble22467_waveforms_12-14DIV.mat');
% SS = SqueakySpk('trouble22467_12-14DIV_DoublePeakSortNR',25000,1,spkdat);
% SS.Save;


%% Wavelet Approach
clear all;
spkdat = load('trouble22467_waveforms_12-14DIV.mat');
SS = SqueakySpk('trouble22467_12-14DIV_WaveletSort_Custom2',25000,1,spkdat);
SS.WaveClus(4,50,'wav',0,0);
SS.Save;


%% PCA Approach
clear all;
spkdat = load('trouble22467_waveforms_12-14DIV.mat');
SS = SqueakySpk('trouble22467_12-14DIV_PCASort_Custom2',25000,1,spkdat);
SS.WaveClus(4,50,'pca',0,0);
SS.Save;