-
Notifications
You must be signed in to change notification settings - Fork 0
/
saveFeaturesGui.m
73 lines (70 loc) · 2.97 KB
/
saveFeaturesGui.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
70
71
72
73
function saveFeaturesGui(saveFile)
% estimate spectral features
%
% In previous versions, there was an additional input parameter called
% "options." In this version a GUI pops up and asks for these options from
% the user.
%
% INPUTS
% saveFile: name of '.mat' file containing the data and labels
% variables. And to which the processed data will be saved
%
% LOADED VARIABLES
% labels: Structure containing labeling infomation for data
% FIELDS USED
% fsRaw: sampling frequency of unprocessed data (Hz)
% area: cell array of labels for each area corresponding to
% the second dimension of xFft
% fs: sampling frequency of processed data (Hz)
% windows: same as allWindows, but with unusable windows eliminated
% X: Preprocessed (filtered, averaged, checked for saturation) data. NxAxW array. A is
% the # of areas. N=number of frequency points per
% window. W=number of time windows.
% windowLength: length of windows (s)
% dataSegments (optional): output data from preprocessing through
% dataSegments method.
%
% SAVED VARIABLES
% power: MxNxP matrix of power values where M is frequency, N is brain area,
% and P is time window
% coherence: MxNxPxQ array to store coherence variables where M is frequency,
% N is time window, and P and Q are the two brain areas where coherence is
% calculated
% granger: PxFxW array to store granger causality values. P
% iterates over directed pairs of regions, F iterates over
% frequencies, W iterates over windows.
% instant: PxFxW array to store instantaneous causality values. P
% iterates over undirected pairs of regions, F iterates over
% frequencies, W iterates over windows.
% causality: PxFxW array to store linear directionality features.P
% iterates over directed pairs of regions, F iterates over
% frequencies, W iterates over windows.
% labels: See above, with
% ADDED FIELDS
% f: integer frequency of processed data
% powerFeatures: MxN matrix of string labels describing the
% features represented in labels.power. M is frequency, N is
% brain area.
% cohFeatures: MxPxQ array of string labels describing the
% features represented in labels.coherence. M is frequency, P
% and Q are the two brain areas where coherence is calculated.
% gcFeatures: PxF array of string labels describing the
% features represented in labels.granger. P iterates over
% directed pairs of regions, F iterates over frequencies.
% instFeatures: PxF array of string labels describing the
% features represented in instArray. P iterates over
% undirected pairs of regions, F iterates over frequencies.
%% Get options from GUI
fprintf('Make sure you are using matlab version R2019a or later')
myGui = gui();
while isvalid(myGui)
options = myGui.getOptions();
pause(0.001);
end
if isvalid(myGui)
% one last check on the off chance that someone clicked an option and closed the app
% in 1ms
options = myGui.getOptions();
end
saveFeatures(saveFile, options)
end