forked from LIMO-EEG-Toolbox/limo_tools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
eegplugin_limo.m
57 lines (50 loc) · 2.87 KB
/
eegplugin_limo.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
function version = eegplugin_limo(fig,try_strings,catch_strings)
% simple plugin function for eeglab
% call the LInear MOdeling of EEG data toolbox
% Multiple choices are available depending on the type
% of analysis
%
% Nicolas Chauveau - Cyril Pernet v1 13/03/2009
% Cyril Pernet v2 22-06-2013
% -----------------------------
% Copyright (C) LIMO Team 2010
version ='LIMO EEG 2.0';
if nargin < 3
error('eegplugin_limo requires 3 arguments');
end;
% add folder to path
% ------------------
if ~exist('pop_loadeep')
p = which('eegplugin_limo.m');
p = p(1:findstr(p,'eegplugin_limo.m')-1);
addpath( p );
end;
% create menus
% ------------
menu=findobj(fig,'tag','tools');
submenu = uimenu(menu, 'Label', version, 'separator', 'on', 'userdata','startup:on,study:on');
uimenu(submenu,'Label', 'GUI','callback','limo_eeg', 'userdata','study:on');
uimenu(submenu,'Label', '1st level analysis','callback','limo_batch', 'userdata','study:off');
uimenu(submenu,'Label', '2nd level analysis','callback','limo_random_effect','userdata','study:on,epoch:off,continuous:off');
uimenu(submenu,'Label', 'LIMO EEG results','callback','limo_results','userdata','study:on');
uimenu(submenu,'Label', 'LIMO EEG tools','callback','limo_tools','userdata','study:on');
% create STUDY menus for EEGLAB 15
% --------------------------------
[vers,vnum] = eeg_getversion;
if isempty(vnum) || vnum >= 15
menu=findobj(fig,'tag','study');
onstudy = 'startup:off;epoch:off;continuous:off;study:on';
nocheck = 'try,';
e_catch = 'catch, eeglab_error; LASTCOM= ''''; clear EEGTMP ALLEEGTMP STUDYTMP; end;';
e_hist = [e_catch 'EEG = eegh(LASTCOM, EEG);'];
e_plot_study = [e_catch 'if ~isempty(LASTCOM), STUDY = STUDYTMP; STUDY = eegh(LASTCOM, STUDY); disp(''Done.''); end; clear ALLEEGTMP STUDYTMP; eeglab(''redraw'');']; % ALLEEG not modified
cb_limorunchan = [ nocheck '[STUDYTMP LASTCOM]= pop_limo(STUDY, ALLEEG,''dat'');' e_plot_study];
cb_limoreschan = [ nocheck 'pop_limoresults(STUDY,''dat'');' e_hist];
cb_limoruncomp = [ nocheck '[STUDYTMP LASTCOM]= pop_limo(STUDY, ALLEEG,''ica'');' e_plot_study];
cb_limorescomp = [ nocheck 'pop_limoresults(STUDY,''ica'');' e_hist];
limo_eeg = uimenu(menu,'Label','LInear MOdeling of EEG Data (BETA TESTING ONLY)' , 'userdata', onstudy,'Tag','limoeeg','separator', 'on');
uimenu( limo_eeg, 'Label', 'Estimate Model Parameters (channnel)' , 'userdata', onstudy, 'CallBack', cb_limorunchan);
uimenu( limo_eeg, 'Label', 'Linear Model Results (channnel)' , 'userdata', onstudy, 'CallBack', cb_limoreschan);
uimenu( limo_eeg, 'Label', 'Estimate Model Parameters (components)' , 'userdata', onstudy, 'CallBack', cb_limoruncomp,'separator', 'on');
uimenu( limo_eeg, 'Label', 'Linear Model Results (components)' , 'userdata', onstudy, 'CallBack', cb_limorescomp);
end