Browse Source

Spike detection fix

master
Apostolos Fanakis 6 years ago
parent
commit
1e7e2e19a6
  1. 7
      spike_sorting.m

7
spike_sorting.m

@ -11,8 +11,6 @@
%%
%% =================================================================================================
%% S.1
clear all
datasetMedians = zeros(8);
datasetFactors = zeros(8);
@ -133,6 +131,7 @@ for fileIndex=1:4
if data(sample) >= threshold
% spike found
numberOfSpikes = numberOfSpikes + 1;
spikeStartIndex = sample;
% skips cheking until values are below threshold again
while sample <= length(data)
@ -145,7 +144,7 @@ for fileIndex=1:4
% Q.2.1
spikesTimesEst(numberOfSpikes) = firstIndex;
% Q.2.2
spikesEst(numberOfSpikes, :) = data(firstIndex-34:firstIndex+29);
spikesEst(numberOfSpikes, :) = data(spikeStartIndex-1+firstIndex-34:spikeStartIndex-1+firstIndex+29);
break;
end
end
@ -154,7 +153,7 @@ for fileIndex=1:4
end
fprintf('%d spikes found for dataset #%d\n', numberOfSpikes, fileIndex);
fprintf('actial number of spikes = %d\n', length(Dataset.spikeTimes));
fprintf('actual number of spikes = %d\n', length(Dataset.spikeTimes));
fprintf('diff = %d\n\n', abs(length(Dataset.spikeTimes) - numberOfSpikes));
figure();

Loading…
Cancel
Save