eeglab.m

来自「含有多种ICA算法的eeglab工具箱」· M 代码 · 共 1,635 行 · 第 1/5 页

M
1,635
字号
% Revision 1.60  2002/04/30 19:03:27  scott% trying global COLOR -sm%% Revision 1.59  2002/04/30 19:01:21  scott% *** empty log message ***%% Revision 1.58  2002/04/30 18:59:59  scott% *** empty log message ***%% Revision 1.57  2002/04/30 18:56:33  scott% *** empty log message ***%% Revision 1.56  2002/04/30 18:52:04  scott% *** empty log message ***%% Revision 1.55  2002/04/30 18:41:05  scott% editting help msg -sm%% Revision 1.54  2002/04/30 18:34:30  scott% *** empty log message ***%% Revision 1.53  2002/04/30 18:33:50  scott% same%% Revision 1.52  2002/04/30 18:33:17  scott% same%% Revision 1.51  2002/04/30 18:32:40  scott% same -sm%% Revision 1.50  2002/04/30 18:31:54  scott% same -sm% .,%% Revision 1.49  2002/04/30 18:30:38  scott% same%% Revision 1.48  2002/04/30 18:30:07  scott% editting color -sm%% Revision 1.47  2002/04/30 18:29:20  scott% editting colors -sm%% Revision 1.46  2002/04/30 18:07:49  arno% multiple colors%% Revision 1.45  2002/04/30 15:16:31  scott% edited help msg -sm%% Revision 1.44  2002/04/26 21:18:20  arno% updating pop_copyset call%% Revision 1.43  2002/04/26 20:46:50  arno% removing old pop_erpimage%% Revision 1.42  2002/04/26 02:58:07  arno% adding pop_newset.m%% Revision 1.41  2002/04/26 02:48:32  scott% editing message%% Revision 1.40  2002/04/25 19:10:26  arno% debugged typp%% Revision 1.39  2002/04/25 19:03:39  arno% single dataset option%% Revision 1.38  2002/04/25 18:51:15  arno% adding extra checks%% Revision 1.37  2002/04/25 18:50:02  arno% updating memory options%% Revision 1.36  2002/04/24 17:05:46  arno% CURRENTSET existance%% Revision 1.35  2002/04/24 15:12:03  scott% [same] -sm%% Revision 1.34  2002/04/24 15:09:41  scott% [same] -sm%% Revision 1.33  2002/04/24 15:09:07  scott% [same] -sm%% Revision 1.32  2002/04/24 15:07:20  scott% trying background color change -sm%% Revision 1.31  2002/04/23 23:49:09  arno% new embeded update%% Revision 1.30  2002/04/23 21:34:20  arno% updating pop_savesets.m%% Revision 1.29  2002/04/23 20:56:39  arno% full reprogramming of the functionfurther updates of pop_delset call%% Revision 1.28  2002/04/23 19:08:55  arno% debuging for pop_delset standalone call%% Revision 1.27  2002/04/23 17:58:16  arno% modifying pop_loadset%% Revision 1.26  2002/04/23 02:03:17  arno% updating menus for old and new pop_erpimage.m%% Revision 1.25  2002/04/22 23:34:40  arno% correcting typo%% Revision 1.24  2002/04/22 01:00:51  arno% fprintf->disp%% Revision 1.23  2002/04/21 01:00:14  scott% edited help msg -sm%% Revision 1.22  2002/04/21 00:03:43  scott% [same] -sm%% Revision 1.21  2002/04/21 00:02:40  scott% [same] -sm%% Revision 1.20  2002/04/21 00:01:29  scott% 'datafile' -> 'data file' -sm%% Revision 1.19  2002/04/21 00:00:10  scott% 'Import Matlab data array' -> 'Import data file or Matlab array' -sm%% Revision 1.18  2002/04/20 17:19:56  arno% adding Done to callbacks%% Revision 1.17  2002/04/18 20:01:13  arno% retrIeve%% Revision 1.16  2002/04/18 03:10:14  scott% changed Edit menu item names -sm%% Revision 1.15  2002/04/18 02:36:22  scott% Load existing dataset(s) -> Load existing dataset -sm%% Revision 1.14  2002/04/18 02:21:01  arno% adding pop-up errors%% Revision 1.13  2002/04/18 00:22:42  scott% Load dataset(s) -> Load existing dataset(s) -sm%% Revision 1.12  2002/04/11 19:09:09  arno% typo in LASTCOM%% Revision 1.11  2002/04/11 19:08:02  arno% adding lastcom argument for erpimage%% Revision 1.10  2002/04/11 18:04:08  arno% not saving a new dataset when average referencing%% Revision 1.9  2002/04/11 03:35:31  arno% editing load and save set menus%% Revision 1.8  2002/04/11 02:33:33  arno% editing menus%% Revision 1.7  2002/04/10 23:16:49  arno% chaning save worksapce menu%% Revision 1.6  2002/04/10 02:12:25  arno% testing version control%% Revision 1.5  2002/04/10 01:01:10  arno% testing version control%% Revision 1.4  2002/04/08 22:59:17  arno% changing rmbase dataset saving status%% Revision 1.3  2002/04/06 02:54:10  arno% change comments call%% Revision 1.2  2002/04/06 02:03:58  arno% editing menus%% Revision 1.1  2002/04/05 17:46:04  jorn% Initial revision%% 01-25-02 reformated help & license -ad % 02-15-02 text interface editing -sm & ad % 03-08-02 removed toolbar option (matlab 5.2 compatibility) -ad% 03-13-02 updated event function calls -ad% 03-16-02 text interface editing -sm & ad % 3/19/02 Help msg edited by sm function [ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab( onearg )% add the paths% -------------eeglabpath = which('eeglab.m');eeglabpath = eeglabpath(1:end-length('eeglab.m'));% test for local SCCN copy% ------------------------if (strcmpi(computer, 'GLNX86') & exist( [ eeglabpath 'functions/adminfunc' ] ) == 7)    myaddpath( eeglabpath, 'readeetraklocs.m', 'functions/sigprocfunc');    myaddpath( eeglabpath, 'eeg_checkset.m',   'functions/adminfunc');    myaddpath( eeglabpath, 'pop_loadbci.m',    'functions/popfunc');    myaddpath( eeglabpath, 'icademo.m',        'functions/miscfunc');    myaddpath( eeglabpath, 'VolumeMNI.bin',    'functions/resources');elseif (strcmpi(computer, 'pcwin') & exist( [ eeglabpath 'functions\adminfunc' ] ) == 7)    myaddpath( eeglabpath, 'readeetraklocs.m', 'functions\sigprocfunc');    myaddpath( eeglabpath, 'eeg_checkset.m',   'functions\adminfunc');    myaddpath( eeglabpath, 'pop_loadbci.m',    'functions\popfunc');    myaddpath( eeglabpath, 'icademo.m',        'functions\miscfunc');    myaddpath( eeglabpath, 'eeglab1020.ced',   'functions\resources');else    myaddpath( eeglabpath, 'readeetraklocs.m', 'functions');        funcpath = which('readeetraklocs.m');    funcpath = funcpath(1:end-length('readeetraklocs.m'));    myaddpath( funcpath , 'eeglab1020.ced', 'resources');    end;myaddpath( eeglabpath, 'eegplugin_dipfit', 'plugins');eeg_options; if nargin == 1 &  strcmp(onearg, 'redraw')    if evalin('base', 'exist(''EEG'')', '0') == 1        evalin('base', 'warning off; eeg_global; warning on;');    end;end;eeg_global;% for the history function% ------------------------evalin('base'  , 'if exist(''h'') == 1, clear h; disp(''EEGLAB note: variable h cleared''); end;');comtmp = 'warning off MATLAB:mir_warning_variable_used_as_function';evalin('base'  , comtmp, '');evalin('caller', comtmp, '');    evalin('base', 'eeg_global;');if nargin < 1 | exist('EEG') ~= 1	clear global EEG ALLEEG CURRENTSET ALLCOM LASTCOM;	eeg_global;	EEG = eeg_emptyset;	h('[ALLEEG EEG CURRENTSET ALLCOM] = eeglab;');    if get(0, 'screendepth') <= 8        disp('Warning: screen color depth too low, some colors will be inaccurate in time-frequency plots');    end;end;if nargin == 1	if strcmp(onearg, 'verions')        disp('EEGLAB v4.4');	elseif strcmp(onearg, 'redraw')		W_MAIN = findobj('tag', 'EEGLAB');		if ~isempty(W_MAIN)			updatemenu;            if nargout < 1, clear ALLEEG; end; % do not return output var			return;		else			h('[ALLEEG EEG CURRENTSET ALLCOM] = eeglab(''rebuild'');');		end;	elseif strcmp(onearg, 'besa');		disp('Besa option deprecated. Download the BESA plugin to add the BESA menu.');        h('[ALLEEG EEG CURRENTSET ALLCOM] = eeglab;');	else        h('[ALLEEG EEG CURRENTSET ALLCOM] = eeglab(''rebuild'');');	end;else     onearg = 'rebuild';end;ALLCOM = ALLCOM;colordef white% checking strings% ----------------e_try = 'try, if exist(''h'') == 1, clear h; disp(''EEGLAB note: variable h cleared''); end;';e_catch = 'catch, errordlg2(lasterr, ''EEGLAB error''); LASTCOM= ''''; clear EEGTMP; end;';nocheck           = e_try;check             = ['[EEG LASTCOM] = eeg_checkset(EEG, ''data''); h(LASTCOM);' e_try];checkcont         = ['[EEG LASTCOM] = eeg_checkset(EEG, ''contdata''); h(LASTCOM);' e_try];checkica          = ['[EEG LASTCOM] = eeg_checkset(EEG, ''ica''); h(LASTCOM);' e_try];checkepoch        = ['[EEG LASTCOM] = eeg_checkset(EEG, ''epoch''); h(LASTCOM);' e_try];checkevent        = ['[EEG LASTCOM] = eeg_checkset(EEG, ''event''); h(LASTCOM);' e_try];checkbesa         = ['[EEG LASTCOM] = eeg_checkset(EEG, ''besa''); h(''% no history yet for BESA dipole localization'');' e_try];checkepochica     = ['[EEG LASTCOM] = eeg_checkset(EEG, ''epoch'', ''ica''); h(LASTCOM);' e_try];checkplot         = ['[EEG LASTCOM] = eeg_checkset(EEG, ''chanloc''); h(LASTCOM);' e_try];checkicaplot      = ['[EEG LASTCOM] = eeg_checkset(EEG, ''ica'', ''chanloc''); h(LASTCOM);' e_try];checkepochplot    = ['[EEG LASTCOM] = eeg_checkset(EEG, ''epoch'', ''chanloc''); h(LASTCOM);' e_try];checkepochicaplot = ['[EEG LASTCOM] = eeg_checkset(EEG, ''epoch'', ''ica'', ''chanloc''); h(LASTCOM);' e_try];storecall    = '[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET); h(''[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);'');';storeload    = '[ALLEEG EEG CURRENTSET] = eeg_store(ALLEEG, EEG); h(''[ALLEEG EEG CURRENTSET] = eeg_store(ALLEEG, EEG);'');';storenewcall = '[ALLEEG EEG CURRENTSET LASTCOM] = pop_newset(ALLEEG, EEG, CURRENTSET); h(LASTCOM);';storeallcall = 'if ~isempty(ALLEEG) & ~isempty(ALLEEG(1).data), ALLEEG = eeg_checkset(ALLEEG); EEG = eeg_checkset(EEG); h(''ALLEEG = eeg_checkset(ALLEEG); EEG = eeg_checkset(EEG);''); end;';e_newnonempty_nh     = [e_catch 'h(LASTCOM); if ~isempty(LASTCOM) & ~isempty(EEGTMP), EEG = EEGTMP;' storenewcall 'disp(''Done.''); end;  clear EEGTMP; eeglab(''redraw'');'];e_load_nh            = [e_catch 'h(LASTCOM); if ~isempty(LASTCOM) & ~isempty(EEGTMP), EEG = EEGTMP;' storeload 'disp(''Done.''); end;  clear EEGTMP; eeglab(''redraw'');'];e_newset_nh          = [e_catch 'h(LASTCOM); if ~isempty(LASTCOM) & ~isempty(EEG),' storenewcall 'disp(''Done.''); end; eeglab(''redraw'');'];e_store_nh           = [e_catch 'h(LASTCOM); if ~isempty(LASTCOM) & ~isempty(EEG) & ~isempty(findstr(''='',LASTCOM)),' storecall 'disp(''Done.''); end; eeglab(''redraw'');'];e_storeall_nh        = [e_catch 'h(LASTCOM); if ~isempty(LASTCOM) & ~isempty(EEG),' storeallcall 'disp(''Done.''); end; eeglab(''redraw'');'];e_hist_nh            = [e_catch 'h(LASTCOM);'];e_histdone_nh        = [e_catch 'h(LASTCOM); if ~isempty(LASTCOM), disp(''Done.''); end;' ];% same as above but also save history in dataset% ----------------------------------------------e_newnonempty   = [e_catch 'EEGTMP = h(LASTCOM, EEGTMP); if ~isempty(LASTCOM) & ~isempty(EEGTMP), EEG = EEGTMP;' storenewcall 'disp(''Done.''); end;  clear EEGTMP; eeglab(''redraw'');'];e_load          = [e_catch 'EEGTMP = h(LASTCOM, EEGTMP); if ~isempty(LASTCOM) & ~isempty(EEGTMP), EEG = EEGTMP;' storeload 'disp(''Done.''); end;  clear EEGTMP; eeglab(''redraw'');'];e_newset        = [e_catch 'EEG = h(LASTCOM, EEG); if ~isempty(LASTCOM) & ~isempty(EEG),' storenewcall 'disp(''Done.''); end; eeglab(''redraw'');'];e_store         = [e_catch 'EEG = h(LASTCOM, EEG); if ~isempty(LASTCOM) & ~isempty(EEG) & ~isempty(findstr(''='',LASTCOM)),' storecall 'disp(''Done.''); end; eeglab(''redraw'');'];e_storeall      = [e_catch 'EEG = h(LASTCOM, EEG); if ~isempty(LASTCOM) & ~isempty(EEG),' storeallcall 'disp(''Done.''); end; eeglab(''redraw'');'];e_hist          = [e_catch 'EEG = h(LASTCOM, EEG);'];e_histdone      = [e_catch 'EEG = h(LASTCOM, EEG); if ~isempty(LASTCOM), disp(''Done.''); end;' ];% build structures for plugins% ----------------------------trystrs.no_check                 = e_try;trystrs.check_ica                = checkica;trystrs.check_cont               = checkcont;trystrs.check_epoch              = checkepoch;trystrs.check_event              = checkevent;trystrs.check_epoch_ica          = checkepochica;trystrs.check_chanlocs           = checkplot;trystrs.check_epoch_chanlocs     = checkepochplot;trystrs.check_epoch_ica_chanlocs = checkepochicaplot;catchstrs.add_to_hist            = e_hist;catchstrs.store_and_hist         = e_store;catchstrs.new_and_hist           = e_newset;% detecting icalab% ----------------if exist('icalab')    disp('ICALAB toolbox detected (algo. added to "run ICA" interface)');

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?