-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateSpkFeatures2.m
More file actions
51 lines (33 loc) · 1.03 KB
/
createSpkFeatures2.m
File metadata and controls
51 lines (33 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function [ outfeats ] = createSpkFeatures2( waveforms, spkFS, normFlag )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
tempWaves = transpose(waveforms);
features = struct;
% Peak
features.Peak = max(tempWaves,[],2);
% Valley
features.Valley = min(tempWaves,[],2);
% Energy
features.Energy = trapz(abs(tempWaves),2);
% Combine for WavePCA analysis
% Peak to Peak width
[pVal, pInd] = max(tempWaves,[],2);
[vVal, vInd] = min(tempWaves,[],2);
features.widthMS = (abs(pInd-vInd)/round(spkFS))*1000;
features.Amp = pVal - vVal;
% features.WavePC1 = pcScores(:,1);
features.FSDE_Values =...
FSDE_Method_d2(tempWaves);
intialX = [features.Peak , abs(features.Valley) ,...
features.Energy , features.widthMS,...
features.FSDE_Values.FDmax , features.FSDE_Values.SDmax ,...
features.Amp];
% Eliminate negative values
if normFlag
ridNegX = abs(intialX);
% Normalize to 0-1
outfeats = bsxfun(@rdivide, ridNegX, max(ridNegX));
else
outfeats = intialX;
end
end