📄 eeglab.m
字号:
% ----------------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;catchstrs.new_non_empty = e_newnonempty; % create eeglab figure % -------------------- eeg_mainfig(onearg); % detecting icalab % ---------------- if exist('icalab') disp('ICALAB toolbox detected (algo. added to "run ICA" interface)'); end; % BIOSIG plugin (not in plugin folder) % ------------------------------------ p = which('eeglab.m'); p = p(1:findstr(p,'eeglab.m')-1); delimiter = p(end); if strcmpi(delimiter, ':'), delmiter = '::'; end; path_biosig = [ p '..' delimiter 'biosig' delimiter 't200' ]; biosigflag = 0; if exist(path_biosig) == 7 try, addpath(path_biosig); addpath([ p '..' delimiter 'biosig' ]); % for str2double version = [ p '..' delimiter 'biosig' delimiter 'VERSION' ]; version = loadtxt(version, 'convert', 'off', 'verbose', 'off'); version = [ version{2,3}(1) '.' version{2,3}(2:end) ]; disp(['eeglab: adding "BIOSIGv' version '" plugin' ]); biosigflag = 1; catch disp([ 'eeglab: cannot find BIOSIG plugin' ] ); disp([ ' ' lasterr] ); end; end; % menu definition % --------------- W_MAIN = findobj('tag', 'EEGLAB'); EEGUSERDAT = get(W_MAIN, 'userdata'); set(W_MAIN, 'MenuBar', 'none'); first_m = uimenu( W_MAIN, 'Label', 'File'); neuromenu = uimenu( first_m, 'Label', 'Import data', 'tag', 'import data'); uimenu( neuromenu, 'Label', 'From ASCII/float file or Matlab array' , 'CallBack', [ nocheck '[EEGTMP LASTCOM] = pop_importdata;' e_newnonempty ]); uimenu( neuromenu, 'Label', 'From EGI .RAW file' , 'CallBack', [ nocheck '[EEGTMP LASTCOM]= pop_readegi;' e_newnonempty ], 'Separator', 'on'); uimenu( neuromenu, 'Label', 'From Segmented EGI .RAW files', 'CallBack', [ nocheck '[EEGTMP LASTCOM]= pop_readsegegi;' e_newnonempty ]); uimenu( neuromenu, 'Label', 'From BCI2000 ASCII file' , 'CallBack', [ nocheck '[EEGTMP LASTCOM]= pop_loadbci;' e_newnonempty ], 'Separator', 'on'); uimenu( neuromenu, 'Label', 'From Snapmaster .SMA file' , 'CallBack', [ nocheck '[EEGTMP LASTCOM]= pop_snapread;' e_newnonempty ], 'Separator', 'on'); uimenu( neuromenu, 'Label', 'From Neuroscan .CNT file' , 'CallBack', [ nocheck '[EEGTMP LASTCOM]= pop_loadcnt;' e_newnonempty ], 'Separator', 'on'); uimenu( neuromenu, 'Label', 'From Neuroscan .EEG file' , 'CallBack', [ nocheck '[EEGTMP LASTCOM]= pop_loadeeg;' e_newnonempty ]); uimenu( neuromenu, 'Label', 'From ERPSS .RAW or .RDF file', 'CallBack', [ nocheck '[EEGTMP LASTCOM]= pop_read_erpss;' e_newnonempty ], 'Separator', 'on'); % BIOSIG MENUS % ------------ if biosigflag combdf = [ trystrs.no_check '[EEGTMP LASTCOM] = pop_readbdf;' catchstrs.new_non_empty ]; comedf = [ trystrs.no_check '[EEGTMP LASTCOM] = pop_readedf;' catchstrs.new_non_empty ]; combio = [ trystrs.no_check '[EEGTMP LASTCOM] = pop_biosig;' catchstrs.new_non_empty ]; uimenu( neuromenu, 'Label', 'From Biosemi .BDF file using BIOSIG', 'CallBack', combdf, 'Separator', 'on'); uimenu( neuromenu, 'Label', 'From .EDF file using BIOSIG' , 'CallBack', comedf, 'tag', 'biosig'); uimenu( neuromenu, 'Label', 'From other formats using BIOSIG' , 'CallBack', combio); end; importepoch = uimenu( first_m, 'Label', 'Import epoch info', 'tag', 'import epoch'); uimenu( importepoch, 'Label', 'From Matlab array or ASCII file', 'CallBack', [ checkepoch '[EEG LASTCOM] = pop_importepoch(EEG);' e_store ]); uimenu( importepoch, 'Label', 'From Neuroscan .DAT file', 'CallBack', [ checkepoch '[EEG LASTCOM]= pop_loaddat(EEG);' e_store]); importevent = uimenu( first_m, 'Label', 'Import event info', 'tag', 'import event'); uimenu( importevent, 'Label', 'From Matlab array or ASCII file', 'CallBack', [ check '[EEG LASTCOM] = pop_importevent(EEG);' e_store]); uimenu( importevent, 'Label', 'From data channel' , 'CallBack', [ check '[EEG LASTCOM]= pop_chanevent(EEG);' e_store]); uimenu( importevent, 'Label', 'From Presentation .LOG file' , 'CallBack', [ check '[EEG LASTCOM]= pop_importpres(EEG);' e_store]); exportm = uimenu( first_m, 'Label', 'Export', 'tag', 'export'); uimenu( exportm, 'Label', 'Data and ICA activity to text file', 'CallBack', [ check 'LASTCOM = pop_export(EEG);' e_histdone ]); uimenu( exportm, 'Label', 'Weight matrix to text file' , 'CallBack', [ check 'LASTCOM = pop_expica(EEG, ''weights'');' e_histdone ]); uimenu( exportm, 'Label', 'Inverse weight matrix to text file', 'CallBack', [ check 'LASTCOM = pop_expica(EEG, ''inv'');' e_histdone ]); uimenu( first_m, 'Label', 'Load existing dataset' , 'Separator', 'on' , 'CallBack', [ nocheck '[EEGTMP LASTCOM] = pop_loadset;' e_load_nh]); uimenu( first_m, 'Label', 'Save current dataset' , 'Separator', 'on', 'CallBack', [ check '[EEG LASTCOM] = pop_saveset(EEG);' e_store]); uimenu( first_m, 'Label', 'Save datasets' , 'CallBack', [ check '[ALLEEG LASTCOM] = pop_saveset(ALLEEG);' e_hist_nh ]); uimenu( first_m, 'Label', 'Clear dataset(s)' , 'CallBack', [ nocheck '[ALLEEG LASTCOM] = pop_delset(ALLEEG, -CURRENTSET);' e_hist_nh 'eeglab redraw;' ]); uimenu( first_m, 'Label', 'Maximize memory' , 'Separator', 'on' , 'CallBack', [ nocheck 'LASTCOM = pop_editoptions;' e_storeall_nh]); hist_m = uimenu( first_m, 'Label', 'Save history' , 'Separator', 'on'); uimenu( hist_m, 'Label', 'Dataset history', 'CallBack', [ nocheck 'LASTCOM = pop_saveh(EEG.history);' e_hist_nh]); uimenu( hist_m, 'Label', 'Session history', 'CallBack', [ nocheck 'LASTCOM = pop_saveh(ALLCOM);' e_hist_nh]); uimenu( first_m, 'Label', 'Quit' , 'Separator', 'on' , 'CallBack', ... [ 'close(gcf); disp(''To save the EEGLAB command history >> pop_saveh(ALLCOM);''); clear global EEG ALLEEG LASTCOM CURRENTSET;']);second_m = uimenu( W_MAIN, 'Label', 'Edit'); uimenu( second_m, 'Label', 'Dataset info' , 'CallBack', [ check '[EEG LASTCOM] = pop_editset(EEG);' e_store]); uimenu( second_m, 'Label', 'Event fields' , 'CallBack', [ checkevent '[EEG LASTCOM] = pop_editeventfield(EEG);' e_store]); uimenu( second_m, 'Label', 'Event values' , 'CallBack', [ checkevent '[EEG LASTCOM] = pop_editeventvals(EEG);' e_store]); uimenu( second_m, 'Label', 'About this dataset', 'CallBack',[ check '[EEG.comments LASTCOM] =pop_comments(EEG.comments, ''About this dataset'');' e_store]); uimenu( second_m, 'Label', 'Channel locations' , 'CallBack', [ ... 'disp(''IMPORTANT: After importing/modifying data channels, you must close'');' ... 'disp(''the channel editing window for the changes to take effect in EEGLAB.'');' ... 'disp(''TIP: call this function directy from the prompt, ">> pop_chanedit([]);"'');' ... 'disp('' to convert between channel location file formats'');' ... '[TMPCHAN LASTCOM] =pop_chanedit(EEG.chanlocs); if ~isempty(LASTCOM), EEG.chanlocs = TMPCHAN; eeg_checkset(EEG, ''chanlocsize'');' ... 'clear TMPCHAN; EEG = h(LASTCOM, EEG);' storecall 'end; eeglab(''redraw'');']); uimenu( second_m, 'Label', 'Select data' , 'CallBack', [ check '[EEG LASTCOM] = pop_select(EEG);' e_newset], 'Separator', 'on'); uimenu( second_m, 'Label', 'Select epochs/events' , 'CallBack', [ checkevent '[EEG TMP LASTCOM] = pop_selectevent(EEG); clear TMP;' e_newset ]); uimenu( second_m, 'Label', 'Copy current dataset' , 'CallBack', [ check '[ALLEEG LASTCOM] = pop_copyset(ALLEEG, CURRENTSET); eeglab(''redraw'');' e_hist_nh], 'Separator', 'on'); uimenu( second_m, 'Label', 'Append datasets', 'CallBack', [ check '[EEGTMP LASTCOM] = pop_mergeset(ALLEEG);' e_newnonempty_nh]); uimenu( second_m, 'Label', 'Delete dataset(s)' , 'CallBack', [ nocheck '[ALLEEG LASTCOM] = pop_delset(ALLEEG, -CURRENTSET);' e_hist_nh 'eeglab redraw;' ]); fourth_m = uimenu( W_MAIN, 'Label', 'Tools', 'tag', 'tools'); uimenu( fourth_m, 'Label', 'Change sampling rate', 'CallBack', [ check '[EEG LASTCOM] = pop_resample(EEG);' e_newset]); uimenu( fourth_m, 'Label', 'Filter the data' , 'CallBack', [ check '[EEG LASTCOM] = pop_eegfilt(EEG);' e_newset]); uimenu( fourth_m, 'Label', 'Re-reference' , 'CallBack', [ check '[EEG LASTCOM] = pop_reref(EEG);' e_newset]); uimenu( fourth_m, 'Label', 'Reject continuous data','CallBack',[ checkcont '[LASTCOM] = pop_eegplot(EEG, 1);' e_hist]); uimenu( fourth_m, 'Label', 'Extract epochs' , 'CallBack', [ check '[EEG tmp LASTCOM] = pop_epoch(EEG); clear tmp;' e_newset check '[EEG LASTCOM] = pop_rmbase(EEG);' e_store], 'Separator', 'on'); uimenu( fourth_m, 'Label', 'Remove baseline' , 'CallBack', [ check '[EEG LASTCOM] = pop_rmbase(EEG);' e_store]); fourth_sub1 = uimenu( fourth_m, 'Label', 'Reject data epochs'); uimenu( fourth_m, 'Label', 'Run ICA' , 'CallBack', [ check '[EEG LASTCOM] = pop_runica(EEG);' e_store], 'foregroundcolor', 'b', 'Separator', 'on'); uimenu( fourth_m, 'Label', 'Remove components' , 'CallBack', [ checkica '[EEG LASTCOM] = pop_subcomp(EEG);' e_newset]); fourth_sub2 = uimenu( fourth_m, 'Label', 'Reject data using ICA'); uimenu( fourth_sub1, 'Label', 'Reject data (all methods)', 'CallBack', [ check 'pop_rejmenu(EEG, 1); LASTCOM = '''';' e_hist]); uimenu( fourth_sub1, 'Label', 'Reject by inspection' , 'CallBack', [ check '[LASTCOM] = pop_eegplot(EEG, 1);' e_hist]); uimenu( fourth_sub1, 'Label', 'Reject extreme values' , 'CallBack', [ checkepoch '[TMP LASTCOM] = pop_eegthresh(EEG, 1); clear TMP;' e_hist]); uimenu( fourth_sub1, 'Label', 'Reject flat line data' , 'CallBack', [ checkepoch '[EEG LASTCOM] = pop_rejtrend(EEG, 1);' e_store]); uimenu( fourth_sub1, 'Label', 'Reject by probability' , 'CallBack', [ checkepoch '[EEG LASTCOM] = pop_jointprob(EEG, 1);' e_store]); uimenu( fourth_sub1, 'Label', 'Reject by kurtosis' , 'CallBack', [ checkepoch '[EEG LASTCOM] = pop_rejkurt(EEG, 1);' e_store]); uimenu( fourth_sub1, 'Label', 'Reject by spectra' , 'CallBack', [ checkepoch '[EEG Itmp LASTCOM] = pop_rejspec(EEG, 1); clear Itmp;' e_store]); uimenu( fourth_sub1, 'Label', 'Export marks to ICA reject', 'separator', 'on', 'CallBack', [ checkepochica ... '[EEG LASTCOM] = eeg_rejsuperpose(EEG, 1,1,1,1,1,1,1,1); h(LASTCOM);' ... 'LASTCOM = ''EEG.reject.icarejmanual = EEG.reject.rejglobal;''; eval(LASTCOM);' e_store ]); uimenu( fourth_sub1, 'Label', 'Reject marked epochs', 'separator', 'on', 'foregroundcolor', 'b', 'CallBack', [ checkepoch ... '[EEG LASTCOM] = eeg_rejsuperpose(EEG, 1,1,1,1,1,1,1,1); EEG = h(LASTCOM, EEG);' ... '[EEG LASTCOM] = pop_rejepoch(EEG);' e_newset]); uimenu( fourth_sub2, 'Label', 'Reject components by map', 'CallBack', [ checkicaplot '[EEG LASTCOM] = pop_selectcomps(EEG);' e_store]); uimenu( fourth_sub2, 'Label', 'Reject data (all methods)','CallBack', [ checkepochica 'pop_rejmenu(EEG, 0); LASTCOM ='''';' e_hist], 'Separator', 'on'); uimenu( fourth_sub2, 'Label', 'Reject by inspection', 'CallBack', [ checkica '[LASTCOM] = pop_eegplot(EEG, 0);' e_hist]); uimenu( fourth_sub2, 'Label', 'Reject extreme values', 'CallBack', [ checkepochica '[TMP LASTCOM] = pop_eegthresh(EEG, 0); clear TMP;' e_hist]); uimenu( fourth_sub2, 'Label', 'Reject flat line activity','CallBack', [ checkepochica '[EEG LASTCOM] = pop_rejtrend(EEG, 0);' e_store]); uimenu( fourth_sub2, 'Label', 'Reject by probability', 'CallBack', [ checkepochica '[EEG LASTCOM] = pop_jointprob(EEG, 0);' e_store]); uimenu( fourth_sub2, 'Label', 'Reject by kurtosis', 'CallBack', [ checkepochica '[EEG LASTCOM] = pop_rejkurt(EEG, 0);' e_store]); uimenu( fourth_sub2, 'Label', 'Reject by spectra', 'CallBack', [ checkepochica '[EEG LASTCOM] = pop_rejspec(EEG, 0);' e_store]); uimenu( fourth_sub2, 'Label', 'Export marks to data reject', 'separator', 'on', 'CallBack', [ checkepochica ... '[EEG LASTCOM] = eeg_rejsuperpose(EEG, 0,1,1,1,1,1,1,1); h(LASTCOM);' ... 'LASTCOM = ''EEG.reject.rejmanual = EEG.reject.rejglobal;''; eval(LASTCOM);' e_store ]); uimenu( fourth_sub2, 'Label', 'Reject marked epochs', 'separator', 'on', 'foregroundcolor', 'b', 'CallBack', [ checkepochica ... '[EEG LASTCOM] = eeg_rejsuperpose(EEG, 0,1,1,1,1,1,1,1); EEG = h(LASTCOM, EEG);' ... '[EEG LASTCOM] = pop_rejepoch(EEG);' e_newset ]); third_m = uimenu( W_MAIN, 'Label', 'Plot', 'tag', 'plot'); loc_m = uimenu( third_m, 'Label', 'Channel locations' ); uimenu( loc_m, 'Label', 'By name' , 'CallBack' , [ checkplot 'LASTCOM = [''figure; topoplot([],EEG.chanlocs, ''''style'''', ''''blank'''', ''''electrodes'''', ''''labelpoint'''');'']; eval(LASTCOM);' e_hist]); uimenu( loc_m, 'Label', 'By number' , 'CallBack', [ checkplot 'LASTCOM = [''figure; topoplot([],EEG.chanlocs, ''''style'''', ''''blank'''', ''''electrodes'''', ''''numpoint'''');'']; eval(LASTCOM);' e_hist]); uimenu( third_m, 'Label', 'Channel data (scroll)' , 'CallBack', [ check 'LASTCOM = pop_eegplot(EEG, 1, 1, 1);' e_hist], 'Separator', 'on'); uimenu( third_m, 'Label', 'Channel spectra and maps' , 'CallBack', [ check 'LASTCOM = pop_spectopo(EEG, 1);' e_hist]); uimenu( third_m, 'Label', 'Channel properties' , 'CallBack', [ checkplot 'LASTCOM = pop_prop(EEG,1);' e_hist]); uimenu( third_m, 'Label', 'Channel ERP image' , 'CallBack', [ checkepoch 'LASTCOM = pop_erpimage(EEG, 1, h(''find'',''pop_erpimage(EEG,1''));' e_hist]); ERP_m = uimenu( third_m, 'Label', 'Channel ERPs'); uimenu( ERP_m, 'Label', 'With scalp maps' , 'CallBack', [ checkplot 'LASTCOM = pop_timtopo(EEG);' e_hist]); uimenu( ERP_m, 'Label', 'In scalp array' , 'CallBack', [ checkplot 'LASTCOM = pop_plottopo(EEG);' e_hist]); uimenu( ERP_m, 'Label', 'In rect. array' , 'CallBack', [ checkepoch '[tmpeeg LASTCOM] = pop_plotdata(EEG, 1); clear tmpeeg;' e_hist]); topo_m = uimenu( third_m, 'Label', 'ERP map series'); uimenu( topo_m, 'Label', 'In 2-D' , 'CallBack', [ checkplot 'LASTCOM = pop_topoplot(EEG, 1);' e_hist]); uimenu( topo_m, 'Label', 'In 3-D' , 'CallBack', [ checkplot '[EEG LASTCOM] = pop_headplot(EEG, 1);' e_store]); uimenu( third_m, 'Label', 'Sum/Compare ERPs' , 'CallBack', [ checkepoch 'LASTCOM = pop_comperp(ALLEEG);' e_hist]); uimenu( third_m, 'Label', 'Component activations (scroll)', 'CallBack', [ checkica '[LASTCOM] = pop_eegplot(EEG, 0, 1, 1);' e_hist],'Separator', 'on'); uimenu( third_m, 'Label', 'Component spectra and maps' , 'CallBack', [ checkicaplot 'LASTCOM = pop_spectopo(EEG, 0);' e_hist]); topoica_m = uimenu( third_m, 'Label', 'Component maps'); uimenu( topoica_m, 'Label', 'In 2-D', 'CallBack', [ checkicaplot 'LASTCOM = pop_topoplot(EEG, 0);' e_hist]); uimenu( topoica_m, 'Label', 'In 3-D', 'CallBack', [ checkicaplot '[EEG LASTCOM] = pop_headplot(EEG, 0);' e_store]); uimenu( third_m, 'Label', 'Component properties' , 'CallBack', [ checkicaplot 'LASTCOM = pop_prop(EEG,0);' e_hist]); uimenu( third_m, 'Label', 'Component ERP image' , 'CallBack', [ checkepochica 'LASTCOM = pop_erpimage(EEG, 0, h(''find'',''pop_erpimage(EEG,0''));' e_hist]); ERPC_m = uimenu( third_m, 'Label', 'Component ERPs'); uimenu( ERPC_m, 'Label', 'With component maps', 'CallBack', [ checkica 'LASTCOM = pop_envtopo(EEG);' e_hist]); uimenu( ERPC_m, 'Label', 'With comp. maps (compare)', 'CallBack', [ checkica 'if length(ALLEEG) == 1, error(''Need at least 2 datasets''); end; LASTCOM = pop_envtopo(ALLEEG);' e_hist]); uimenu( ERPC_m, 'Label', 'In rectangular array' , 'CallBack', [ checkepochica '[tmpeeg LASTCOM] = pop_plotdata(EEG, 0); clear tmpeeg;' e_hist]); uimenu( third_m, 'Label', 'Sum/Compare comp. ERPs' , 'CallBack', [ checkepochica 'LASTCOM = pop_comperp(ALLEEG, 0);' e_hist]); stat_m = uimenu( third_m, 'Label', 'Data statistics', 'Separator', 'on'); %, 'enable', fastif(exist('kstest'), 'on', 'off')); uimenu( stat_m, 'Label', 'Channel statistics' , 'CallBack', [ check 'LASTCOM = pop_signalstat(EEG, 1);' e_hist]); uimenu( stat_m, 'Label', 'Component statistics' , 'CallBack', [ checkica 'LASTCOM = pop_signalstat(EEG, 0);' e_hist]); uimenu( stat_m, 'Label', 'Event statistics' , 'CallBack', [ checkevent 'LASTCOM = pop_eventstat(EEG);' e_hist]); spec_m = uimenu( third_m, 'Label', 'Time-frequency transforms', 'Separator', 'on'); uimenu( spec_m, 'Label', 'Channel time-frequency' , 'CallBack', [ checkepoch 'LASTCOM = pop_timef(EEG, 1, h(''find'',''pop_timef(EEG,1''));' e_hist]); uimenu( spec_m, 'Label', 'Channel cross-coherence' , 'CallBack', [ checkepoch 'LASTCOM = pop_crossf(EEG, 1,h(''find'',''pop_crossf(EEG,1''));' e_hist]); uimenu( spec_m, 'Label', 'Component time-frequency' , 'CallBack', [ checkepochica 'LASTCOM = pop_timef(EEG, 0, h(''find'',''pop_timef(EEG,0''));' e_hist],'Separator', 'on'); uimenu( spec_m, 'Label', 'Component cross-coherence', 'CallBack', [ checkepochica 'LASTCOM = pop_crossf(EEG, 0,h(''find'',''pop_crossf(EEG,0''));' e_hist]); set_m = uimenu( W_MAIN, 'Label', 'Datasets'); help_m = uimenu( W_MAIN, 'Label', 'Help'); uimenu( help_m, 'Label', 'About EEGLAB', 'CallBack', 'pophelp(''eeglab'');'); uimenu( help_m, 'Label', 'About EEGLAB help', 'CallBack', 'pophelp(''eeg_helphelp'');'); uimenu( help_m, 'Label', 'EEGLAB license', 'CallBack', 'pophelp(''license.txt'', 1);'); uimenu( help_m, 'Label', 'EEGLAB menus', 'CallBack', 'eeg_helpmenu;','separator','on'); help_subm1 = uimenu( help_m, 'Label', 'EEGLAB functions'); uimenu( help_subm1, 'Label', 'Toolbox functions', 'CallBack', 'pophelp(''ica'');'); uimenu( help_subm1, 'Label', 'Signal processing functions', 'callback', 'eeg_helpsigproc;'); uimenu( help_subm1, 'Label', 'Interactive pop_ functions', 'callback', 'eeg_helppop;'); help_subm2 = uimenu( help_m, 'Label', 'EEGLAB advanced'); uimenu( help_subm2, 'Label', 'Dataset structure', 'CallBack', 'pophelp(''eeg_checkset'');'); uimenu( help_subm2, 'Label', 'Admin functions', 'callback', 'eeg_helpadmin;'); uimenu( help_m, 'Label', 'Tutorial (web)', 'CallBack', 'tutorial;'); uimenu( help_m, 'Label', 'Contact us (email)', 'CallBack', 'web(''mailto:eeglab@sccn.ucsd.edu'');'); % looking for eeglab plugins % -------------------------- p = which('eeglab.m'); p = p(1:findstr(p,'eeglab.m')-1); dircontent1 = what(p); dircontent = dir([ p 'plugins' ]); delimiter = p(end); if strcmpi(delimiter, ':'), delmiter = '::'; end; dircontent = { dircontent1.m{:} dircontent.name }; % scan plugin folder % ------------------ for index = 1:length(dircontent) % find function % ------------- funcname = ''; if exist(dircontent{index}) == 7 if ~strcmpi(dircontent{index}, '.') & ~strcmpi(dircontent{index}, '..') addpath([ p 'plugins' delimiter dircontent{index} ]); tmpdir = dir([ p 'plugins' delimiter dircontent{index}]); for tmpind = 1:length(tmpdir) % find plugin function in subfolder % --------------------------------- if ~isempty(findstr(tmpdir(tmpind).name, 'eegplugin')) & tmpdir(tmpind).name(end) == 'm' funcname = tmpdir(tmpind).name(1:end-2); tmpind = length(tmpdir); end; % spetial case of eeglab subfolder (for BIOSIG) % -------------------------------- if strcmpi(tmpdir(tmpind).name, 'eeglab') addpath([ p 'plugins' delimiter dircontent{index} delimiter 'eeglab' ],'-end'); tmpdir2 = dir([ p 'plugins' delimiter dircontent{index} delimiter 'eeglab' ]); for tmpind2 = 1:length(tmpdir2) if ~isempty(findstr(tmpdir2(tmpind2).name, 'eegplugin')) ... & tmpdir2(tmpind2).name(end) == 'm' funcname = tmpdir2(tmpind2).name(1:end-2); tmpind2 = length(tmpdir2); tmpind = length(tmpdir); end; end; end; end; end; else if ~isempty(findstr(dircontent{index}, 'eegplugin')) & dircontent{index}(end) == 'm' funcname = dircontent{index}(1:end-2); % remove .m end; end; % execute function % ---------------- if ~isempty(funcname) vers = ''; % version try, eval( [ 'vers =' funcname '(gcf, trystrs, catchstrs);' ]); disp(['eeglab: adding "' vers '" plugin (see >> help ' funcname ')' ]); catch try, eval( [ funcname '(gcf, trystrs, catchstrs)' ]); disp(['eeglab: adding plugin function "' funcname '"' ]); catch disp([ 'eeglab: error while adding plugin "' funcname '"' ] ); disp([ ' ' lasterr] ); end; end; end; end; % changing plugin menu color % -------------------------- fourthsub_m = findobj('parent', fourth_m); plotsub_m = findobj('parent', third_m); importsub_m = findobj('parent', neuromenu); epochsub_m = findobj('parent', importepoch); eventsub_m = findobj('parent', importevent); exportsub_m = findobj('parent', exportm); icadefs; % containing PLUGINMENUCOLOR if length(fourthsub_m) > 10, set(fourthsub_m(1:end-10), 'foregroundcolor', PLUGINMENUCOLOR); end; if length(plotsub_m) > 17, set(plotsub_m (1:end-17), 'foregroundcolor', PLUGINMENUCOLOR); end; if length(importsub_m) > 8, set(importsub_m(1:end-8) , 'foregroundcolor', PLUGINMENUCOLOR); end; if length(epochsub_m ) > 2 , set(epochsub_m (1:end-2 ), 'foregroundcolor', PLUGINMENUCOLOR); end; if length(eventsub_m ) > 3 , set(eventsub_m (1:end-3 ), 'foregroundcolor', PLUGINMENUCOLOR); end; if length(exportsub_m) > 3 , set(exportsub_m(1:end-3 ), 'foregro
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -