📄 pop_runica.m
字号:
end; else % if there are defined 'options' if rank(tmpdata) == size(EEG.data,1) | ~isempty(findstr('pca', options)) eval(sprintf('[EEG.icaweights,EEG.icasphere] = runica( tmpdata %s );', options)); else eval(sprintf('[EEG.icaweights,EEG.icasphere] = runica( tmpdata %s, ''pca'', %d );', options, tmprank)); end; end; case 'binica' if ~isunix | strcmp(computer, 'MAC') error('Pop_runica: binica can now only be used under specific UNIX OS'); end; icadefs; fprintf(['Warning: if the binary ICA function does not work, check that you have added the\n' ... 'binary file location (in the EEGLAB directory) to your Unix /bin directory (.cshrc file)\n']); if exist(ICABINARY) ~= 2 error('Pop_runica: binary ICA program cannot be found. Edit icadefs.m file to specify ICABINARY variable'); end; tmprank = rank(tmpdata(:,1:floor(size(tmpdata,2)/2))); if rank(tmpdata) < size(EEG.data,1), disp(['Data rank (' int2str(tmprank) ') less than the number of channels (' int2str(size(EEG.data,1)) ').']); end; if length(options) < 2 if rank(tmpdata) == size(EEG.data,1), [EEG.icaweights,EEG.icasphere] = binica( tmpdata, 'lrate', 0.001 ); else [EEG.icaweights,EEG.icasphere] = binica( tmpdata, 'lrate', 0.001, 'pca', tmprank ); end; else % if defined 'options' if rank(tmpdata) == size(EEG.data,1) | ~isempty(findstr('pca', options)) eval(sprintf('[EEG.icaweights,EEG.icasphere] = binica( tmpdata %s );', options)); else eval(sprintf('[EEG.icaweights,EEG.icasphere] = binica( tmpdata %s, ''pca'', %d );', options, tmprank)); end; end; case 'jader' if length(options) < 2 [EEG.icaweights] = jader( tmpdata ); else eval(sprintf('[EEG.icaweights] = jader( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); case 'matlabshibbsr' if length(options) < 2 [EEG.icaweights] = MatlabshibbsR( tmpdata ); else eval(sprintf('[EEG.icaweights] = MatlabshibbsR( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); case 'pearson_ica' if length(options) < 2 [tmp EEG.icaweights] = pearson_ica( tmpdata, 'maxNumIterations', 1000,'epsilon',0.0005); else eval(sprintf('[tmp EEG.icaweights] = pearson_ica( tmpdata %s );', options)); end; clear tmp; EEG.icasphere = eye(size(EEG.icaweights,2)); case 'egld_ica' disp('Warning: this algorithm is very slow'); if length(options) < 2 [tmp EEG.icaweights] = egld_ica( tmpdata ); else eval(sprintf('[tmp EEG.icaweights] = egld_ica( tmpdata %s );', options)); end; clear tmp; EEG.icasphere = eye(size(EEG.icaweights,2)); case 'eea' if length(options) < 2 [EEG.icaweights] = eeA( tmpdata ); else eval(sprintf('[EEG.icaweights] = eeA( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); case 'icaml' if length(options) < 2 [tmp EEG.icaweights] = icaML( tmpdata ); else eval(sprintf('[tmp EEG.icaweights] = icaML( tmpdata %s );', options)); end; clear tmp; EEG.icasphere = eye(size(EEG.icaweights,2)); case 'icams' if length(options) < 2 [tmp EEG.icaweights] = icaMS( tmpdata ); else eval(sprintf('[tmp EEG.icaweights] = icaMS( tmpdata %s );', options)); end; clear tmp; EEG.icasphere = eye(size(EEG.icaweights,2)); case 'tfbss' if length(options) < 2 [tmp EEG.icaweights] = tfbss( tmpdata, size(tmpdata,1), 8, 512 ); else eval(sprintf('[tmp EEG.icaweights] = tfbss( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); clear tmp; case 'tica' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 EEG.icaweights = tica( tmpdata, size(tmpdata,1) ); else eval(sprintf('EEG.icaweights = tica( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'erica' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 EEG.icaweights = erica( tmpdata, size(tmpdata,1) ); else eval(sprintf('EEG.icaweights = erica( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'simbec' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 EEG.icaweights = simbec( tmpdata, size(tmpdata,1) ); else eval(sprintf('EEG.icaweights = simbec( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'unica' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 EEG.icaweights = unica( tmpdata, size(tmpdata,1) ); else eval(sprintf('EEG.icaweights = unica( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'amuse' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 EEG.icaweights = amuse( tmpdata ); else eval(sprintf('EEG.icaweights = amuse( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'fobi' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 [tmp EEG.icaweights] = fobi( tmpdata, size(tmpdata,1) ); else eval(sprintf('EEG.icaweights = fobi( tmpdata %s );', options)); end; clear tmp; EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'evd' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 EEG.icaweights = evd( tmpdata ); else eval(sprintf('EEG.icaweights = evd( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'sons' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 EEG.icaweights = sons( tmpdata ); else eval(sprintf('EEG.icaweights = sons( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'jadeop' if length(options) < 2 EEG.icaweights = jadeop( tmpdata ); else eval(sprintf('EEG.icaweights = jadeop( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); case 'jade_td_p' if length(options) < 2 EEG.icaweights = jade_td_p( tmpdata, size(tmpdata,1) ); else eval(sprintf('EEG.icaweights = jade_td_p( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); case 'evd24' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 EEG.icaweights = evd24( tmpdata ); else eval(sprintf('EEG.icaweights = evd24( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'sobi' fig = figure('tag', 'alg_is_run', 'visible', 'off'); disp('Running sobi...'); if length(options) < 2 EEG.icawinv = sobi( EEG.data ); else eval(sprintf('EEG.icawinv = sobi( EEG.data %s );', options)); end; EEG.icaweights = pinv(EEG.icawinv); EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'ng_ol' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 [tmp EEG.icaweights] = ng_ol( tmpdata ); else eval(sprintf('[ EEG.icaweights tmp ] = ng_ol( tmpdata %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); clear tmp; close(fig); case 'acsobiro' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 EEG.icawinv = acsobiro( EEG.data, size(tmpdata,1) ); else eval(sprintf('EEG.icawinv = acsobiro( EEG.data %s );', options)); end; EEG.icaweights = pinv(EEG.icawinv); EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'acrsobibpf' fig = figure('tag', 'alg_is_run', 'visible', 'off'); if length(options) < 2 EEG.icawinv = acrsobibpf( tmpdata, size(tmpdata,1) ); else eval(sprintf('EEG.icawinv = acrsobibpf( tmpdata %s );', options)); end; EEG.icaweights = pinv(EEG.icawinv); EEG.icasphere = eye(size(EEG.icaweights,2)); close(fig); case 'fastica' if ~exist('fastica', 'file') & ~exist('fastica', 'dir') error('Pop_runica: to use fastica, you must first download the toolbox (see >> help pop_runica)'); end; if length(options) < 2 eval([ '[ ICAcomp, EEG.icaweights, EEG.icawinv] = fastica( tmpdata, ''displayMode'', ''off'' );' ]); else eval(sprintf('[ ICAcomp, EEG.icaweights, EEG.icawinv] = fastica( tmpdata, ''displayMode'', ''off'' %s );', options)); end; EEG.icasphere = eye(size(EEG.icaweights,2)); otherwise, error('Pop_runica: unrecognized algorithm');end;if ~isempty(fig), try, close(fig); catch, end; end;EEG.icawinv = pinv(EEG.icaweights*EEG.icasphere); % a priori same result as inveeg_options; if option_computeica EEG.icaact = (EEG.icaweights*EEG.icasphere)*reshape(EEG.data, EEG.nbchan, EEG.trials*EEG.pnts); EEG.icaact = reshape( EEG.icaact, size(EEG.icaact,1), EEG.pnts, EEG.trials);end;if nargin < 2 if length(options) < 2 com = sprintf('%s = pop_runica(%s, ''%s'');', inputname(1), inputname(1), icatype); else com = sprintf('%s = pop_runica(%s, ''%s'' %s);', inputname(1),inputname(1), icatype, options); end;end;return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -