-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupport_eventRelatedFunc.m
35 lines (31 loc) · 1.3 KB
/
support_eventRelatedFunc.m
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
function result = support_eventRelatedFunc(trials_array, method)
% This function does the "dimension reduction" by e.g. averaging all
% trials samplewise, but it can utilize other functions too, e.g. SD
% to be used for feature extraction purposes for ML, etc. DEV only
result = NaN(size(trials_array, 1), 1);
if method == 1 % ERPD
result = mean(trials_array,2,'omitnan');
elseif method == 2 % ERPD-SD
result = std(trials_array, 0, 2,'omitnan');
elseif method == 3 % ERPD-Ku
result = kurtosis(trials_array, 1, 2);
elseif method == 4 % ERPD-Sk
result = skewness(trials_array, 1, 2);
elseif method == 5 % ERPD-MAD
result = mad(trials_array, 1, 2);
elseif method == 6 % ERPD-Min
result = min(trials_array,[],2,'omitnan');
elseif method == 7 % ERPD-Max
result = max(trials_array,[],2,'omitnan');
elseif method == 8 % ERPD-KMax
for chu = 1:size(trials_array, 1)
[tempf, tempxi] = ksdensity(trials_array(chu,:));
result(chu) = tempxi( tempf==max(tempf) );
end
elseif method == 9 % ERPD-KVal
for chu = 1:size(trials_array, 1)
[tempf, tempxi] = ksdensity(trials_array(chu,:));
result(chu) = max(tempf);
end
end
end