-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathebAISScore.m
69 lines (56 loc) · 2.01 KB
/
ebAISScore.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function newThingie = ebAISScore(dataThingie, z)
% function newThingie = ebAISScore(dataThingie, z)
%
% This block assumes that you give it either (1) a vector of 14 scores
% (arranged in Emotiv EPOC/EPOC+ order) or (2) a data structure with
% fields: .mean and .std; each of which is a vector of length 14. If given
% the first, the return is a new data strcuture with a length 7 vector of
% scores, called .meanAIS. If given the second, it will return a new data
% structure with .meanAIS, .upperAIS, and .lowerAIS.
%
% The variable z is the SE multiplier for intervals and defaults to 2.
%
% MDT
% 2016.02.14
% Version 0.0.2
% Setup the local variables & do some checks!
if nargin < 2 % Use the usual SE multiplier of dos!
z = 2.0;
end
thingieMode = 0;
vectorMode = 0;
if isstruct(dataThingie)
thingieMode = 1;
bandAverages = dataThingie.mean;
bandSDs = dataThingie.std;
end
if isnumeric(dataThingie)
vectorMode = 1;
bandAverages = dataThingie; % NB: in this case the dataThingie is a vector
bandSDs = 0; % Logical FALSE (trick!)
end
if thingieMode & vectorMode
error('ebAISScore: Input data type unrecognized! Something bad happened.');
end
% Calculation time! All of this is wrong!!!!!!
% bandDiffs = bandAverages(end:-1:(length(bandAverages)/2)+1) - bandAverages(1:length(bandAverages)/2)
%
% if bandSDs
% bandErrors = bandSDs(end:-1:(length(bandSDs)/2)+1).^2 + bandSDs(1:length(bandSDs)/2).^2;
% bandErrors = sqrt(bandErrors);
% upperPowers = bandDiffs + z*bandErrors;
% lowerPowers = bandDiffs - z*bandErrors;
% end
%
% meanAIS
%
%
% Set up the output to return the answers! :-)
if bandSDs
newThingie.meanAIS = meanAIS;
newThingie.upperAIS = upperAIS;
newThingie.lowerAIS = lowerAIS;
else
newThingie.meanAIS = meanAIS;
end
end