-
Notifications
You must be signed in to change notification settings - Fork 0
/
d2d_vis_artifacts.m
46 lines (38 loc) · 1.42 KB
/
d2d_vis_artifacts.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
%
% - Wrapper function for the vis_artifacts function in the clean_rawdata plugin for EEGLAB
%
% Dusk2Dawn
% Author: Richard Somervail, Istituto Italiano di Tecnologia, 2022
% www.iannettilab.net
%%
function EEG = d2d_vis_artifacts( EEG, cfg )
%% check whether 2 datasets were selected, if no then just assume 0 varied parameters and plot data before/after ASR
if isempty(cfg)
% EEG plotted in red
ctemp = [];
ctemp.loadRaw = true;
EEG_red = d2d_loadData(EEG,ctemp);
% EEG plotted in blue
ctemp = [];
ctemp.loadRaw = false;
EEG_blue = d2d_loadData(EEG,ctemp);
%% else load 2 datasets specified by the cfg selections
else
% EEG plotted in red
ctemp = [];
flds = fields(cfg);
for k = 1:length(flds) % get parameters needed to load dataset
ctemp.( strrep(flds{k},'selL','sel') ) = cfg.(flds{k}); % rename field so that lower level function recognises the inputs
end
EEG_red = d2d_loadData(EEG,ctemp);
% EEG plotted in blue
ctemp = [];
flds = fields(cfg);
for k = 1:length(flds) % get parameters needed to load dataset
ctemp.( strrep(flds{k},'selR','sel') ) = cfg.(flds{k}); % rename field so that lower level function recognises the inputs
end
ctemp.loadRaw = false;
EEG_blue = d2d_loadData(EEG,ctemp);
end
%% call vis_artifacts function with these two datasets
vis_artifacts( EEG_blue, EEG_red, 'EqualizeChannelScaling',false );