⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pop_comperp.m

📁 含有多种ICA算法的eeglab工具箱
💻 M
📖 第 1 页 / 共 2 页
字号:
% pop_comperp() - Compute the grand average ERP waveforms of multiple datasets,%                 with optional ERP subtraction.% Usage:%       >> pop_comperp( ALLEEG, flag );      % pop-up window mode%       >> [erp1 erp2 erpsub time sig] = pop_comperp( ALLEEG, flag, ...%                                   datadd, datsub, 'key', 'val', ...);% Inputs:%   ALLEEG  - Array of EEG datasets%   flag    - [0|1] (1) Use raw data or (0) ICA components. {default: 1}%   datadd  - [integer array] List of datasets to sum to make an ERP %             grand average.%   datsub  - [integer array] List of datasets to subtract to make an ERP%             grand average. This option is to be used to compare%             sub-conditions; each array must have the same number of %             elements as the respective 'datadd' datasets. %             e.g., The first 'datsub' dataset is subtracted from first %             'datadd' dataset. The two datasets may normally contain data %             from the same subject under different experiemtal conditions.%% Optional inputs:%   'chans'    - [integer array] Vector of channel or component indices. %                {default: all}.%   'title'    - [string] Plot title. {default: none}%   'tlim'     - [min max] sub-time window in ms to plot data. Default: whole %                time range.%   'ylim'     - [min max] y-axis limits. Default: auto.%   'alpha'    - [float] Apply t-test for p=alpha (0<alpha<1). Use paired if%                t-test datasub is not empty (two-tailed). If data is empty,%                use t-test against a 0 mean dataset with same variance (two-%                tailed). Significan time regions are highlighted in the%                data plots.%   'geom'     - ['scalp'|'array'] Plot erps in a scalp array (plottopo())%                or as a rectangular array (plotdata()). Note: Components%                cannot be plotted in a 'scalp' array.%   'mode'     - ['ave'|'rms'] Plot grand average or RMS (root mean square)%   'addavg'   - ['on'|'off'] Show average/RMS for datadd. Default: 'on' if%                datsub empty, otherwise 'off'.%   'addstd'   - ['on'|'off'] Show standard deviation for datadd. Default: 'on'%                if datsub empty, otherwise 'off'.%   'addall'   - ['on'|'off'] Show all erps for dataadd. Default: 'off'.%   'subavg'   - ['on'|'off'] Show average/RMS for datsub. Default: 'off'.%   'substd'   - ['on'|'off'] Show standard deviation for datsub. Default: 'off'.%   'suball'   - ['on'|'off'] Show all erps for datasub. Default: 'off'.%   'diffadd'  - ['on'|'off'] Show average/RMS for difference. Default: 'on'.%   'diffstd'  - ['on'|'off'] Show standard deviation for difference.%                Default is 'on'.%   'diffall'  - ['on'|'off'] Show all erps for difference. Default: 'off'.%   'tplotopt' - [cell array] 'key', val' plotting options for plottopo%% Output:%   erp1   - Grand average (or rms) of 'datadd' datasets%   erp2   - Grand average (or rms) of 'datsub' datasets%   erpsub - Grand average (or rms) 'datadd' minus 'datsub' difference%   times  - Array of epoch time indices%   sig    - P significance values (chans,times). %% Author: Arnaud Delorme, CNL / Salk Institute, 15 March 2003%% Note: t-test functions were adapted for matric preocessing from %       functions of C. Goutte. See description inside the code of this%       function for more info.%% See also: eeglab(), plottopo()%123456789012345678901234567890123456789012345678901234567890123456789012% Copyright (C) 15 March 2003 Arnaud Delorme, Salk Institute, arno@salk.edu%% This program is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2 of the License, or% (at your option) any later version.%% This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% GNU General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this program; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA% $Log: pop_comperp.m,v $% Revision 1.27  2004/02/10 21:40:58  arno% return correct outputs%% Revision 1.26  2004/02/10 17:26:14  arno% adding tlim and ylim option%% Revision 1.25  2004/01/30 16:05:16  arno% text in legend%% Revision 1.24  2003/12/04 17:49:06  arno% same%% Revision 1.23  2003/12/04 17:47:26  arno% eegfiltfft%% Revision 1.22  2003/12/04 15:34:27  arno% fixing erp add%% Revision 1.21  2003/11/18 16:35:40  scott% Enter ... -> ...%% Revision 1.20  2003/11/04 15:29:53  arno% returning empty pvalues if alpha not set%% Revision 1.19  2003/07/29 19:10:31  arno% same thing%% Revision 1.18  2003/07/29 19:01:50  arno% handle empty ICA matrices%% Revision 1.17  2003/07/16 18:54:47  arno% changing default%% Revision 1.16  2003/07/15 22:00:07  arno% fixing backward compatibility problem%% Revision 1.15  2003/07/15 21:14:40  arno% changed name of dataset%% Revision 1.14  2003/07/15 21:12:33  arno% added backward compatibility%% Revision 1.13  2003/07/15 18:49:43  arno% debug remaning problems%% Revision 1.12  2003/07/15 18:40:07  arno% debugging difference ...%% Revision 1.11  2003/07/15 17:19:04  arno% reprogrammed the function completelly to allow more options%% Revision 1.10  2003/05/10 17:59:21  arno% debug command output%% Revision 1.9  2003/04/15 23:38:35  arno% debuging last%% Revision 1.8  2003/04/15 17:10:14  arno% adding low pass filtering capabilities%% Revision 1.7  2003/04/15 00:26:15  arno% debug alpha%% Revision 1.6  2003/04/15 00:15:32  arno% axis off%% Revision 1.5  2003/04/15 00:12:30  arno% debuging for 1 dataset only%% Revision 1.4  2003/03/18 00:27:53  arno% adding help button%% Revision 1.3  2003/03/17 23:42:31  arno% adding lots of options%% Revision 1.2  2003/03/16 07:47:26  scott% header msg%% Revision 1.1  2003/03/16 03:00:52  arno% Initial revision%function [erp1, erp2, erpsub, times, pvalues] = pop_comperp( ALLEEG, flag, datadd, datsub, varargin);erp1 = '';if nargin < 1   help pop_comperp;   return;end;if isempty(ALLEEG)    error('pop_comperp: cannot process empty sets of data');end;if nargin < 2   flag = 1;end;allcolors = { 'b' 'r' 'g' 'c' 'm' 'r' 'b' 'g' 'c' 'm' 'r' 'b' 'g' 'c' 'm' 'r' 'b' ...              'g' 'c' 'm' 'r' 'b' 'g' 'c' 'm' 'r' 'b' 'g' 'c' 'm' 'r' 'b' 'g' 'c' 'm'};erp1 = '';if nargin < 3    gtmp = [1.1 0.8 .18 .18 .18 0.1]; gtmp2 = [1.48 1.07 0.93];    uigeom = { [2.6 0.95] gtmp gtmp gtmp [1] gtmp2 gtmp2 [1.48 0.21 1.79] gtmp2 [0.6 0.5 0.9] };    commulcomp= ['if get(gcbo, ''value''),' ...                 '    set(findobj(gcbf, ''tag'', ''multcomp''), ''enable'', ''on'');' ...                 'else,' ...                 '    set(findobj(gcbf, ''tag'', ''multcomp''), ''enable'', ''off'');' ...                 'end;'];	uilist = { { } ...               { 'style' 'text' 'string' 'avg.        std.      all ERPs' } ...               { 'style' 'text' 'string' 'Datasets to add (ex: 1 3 4):' } ...               { 'style' 'edit' 'string' '' } ...               { 'style' 'checkbox' 'string' '' 'value' 1 } ...               { 'style' 'checkbox' 'string' '' } ...               { 'style' 'checkbox' 'string' '' } { } ...	           { 'style' 'text' 'string' 'Datasets to subtract (ex: 5 6 7):' } ...               { 'style' 'edit' 'string' '' } ...               { 'style' 'checkbox' 'string' '' 'value' 1 } ...               { 'style' 'checkbox' 'string' '' } ...               { 'style' 'checkbox' 'string' '' } { } ...	           { 'style' 'text' 'string' 'Plot difference' } { } ...               { 'style' 'checkbox' 'string' '' 'value' 1 } ...               { 'style' 'checkbox' 'string' '' } ...               { 'style' 'checkbox' 'string' '' } { } ...               { } ...	           { 'style' 'text' 'string' fastif(flag, 'Channels subset ([]=all):', ...                                                  'Components subset ([]=all):') } ...               { 'style' 'edit' 'string' '' } { } ...	           { 'style' 'text' 'string' 'Highlight significant regions (.01 -> p=.01)' } ...               { 'style' 'edit' 'string' '' } { } ...	           { 'style' 'text' 'string' 'Use RMS instead of average (check):' } { 'style' 'checkbox' 'string' '' } { } ...	           { 'style' 'text' 'string' 'Low pass (Hz) (for display only)' } ...               { 'style' 'edit' 'string' '' } { } ...               { 'style' 'text' 'string' 'Plottopo options (''key'', ''val''):' } ...               { 'style' 'pushbutton' 'string' 'Help' 'callback', 'pophelp(''plottopo'')' } ...               { 'style' 'edit' 'string' '''ydir'', -1' }};        % remove geometry textbox for ICA components    result = inputgui( uigeom, uilist, 'pophelp(''pop_comperp'')', 'ERP grand average/RMS - pop_comperp()');    if length(result) == 0, return; end;    %decode parameters list    options = {};    datadd = eval( [ '[' result{1} ']' ]);    if result{2},  options = { options{:} 'addavg'  'on' }; else, options = { options{:} 'addavg'  'off' }; end;    if result{3},  options = { options{:} 'addstd'  'on' }; else, options = { options{:} 'addstd'  'off' }; end;    if result{4},  options = { options{:} 'addall'  'on' }; end;    datsub = eval( [ '[' result{5} ']' ]);    if result{6},  options = { options{:} 'subavg'  'on' }; end;    if result{7},  options = { options{:} 'substd'  'on' }; end;    if result{8},  options = { options{:} 'suball'  'on' }; end;    if result{9},  options = { options{:} 'diffavg' 'on' }; else, options = { options{:} 'diffavg' 'off' }; end;    if result{10}, options = { options{:} 'diffstd' 'on' }; else, options = { options{:} 'diffstd' 'off' }; end;    if result{11}, options = { options{:} 'diffall' 'on' }; end;        if result{12},           options = { options{:} 'chans' eval( [ '[' result{12} ']' ]) }; end;    if ~isempty(result{13}), options = { options{:} 'alpha' str2num(result{13}) }; end;    if result{14},           options = { options{:} 'mode' 'rms' }; end;    if ~isempty(result{15}), options = { options{:} 'lowpass' str2num(result{15}) }; end;    if ~isempty(result{16}), options = { options{:} 'tplotopt' eval([ '{ ' result{16} ' }' ]) }; end; else     options = varargin;end;% decode inputs% -------------if isempty(datadd), error('First edit box (datasets to add) can not be empty'); end;g = finputcheck( options, ...                  { 'chans'    'integer'  [0:ALLEEG(datadd(1)).nbchan] 0;                   'title'    'string'   []               '';                   'alpha'    'float'    []               [];                   'geom'     'string'  {'scalp' 'array'} fastif(flag, 'scalp', 'array');                   'addstd'   'string'  {'on' 'off'}      fastif(isempty(datsub), 'on', 'off');                   'substd'   'string'  {'on' 'off'}     'off';                   'diffstd'  'string'  {'on' 'off'}     'on';                   'addavg'   'string'  {'on' 'off'}     fastif(isempty(datsub), 'on', 'off');                   'subavg'   'string'  {'on' 'off'}     'off';                   'diffavg'  'string'  {'on' 'off'}     'on';                   'addall'   'string'  {'on' 'off'}     'off';                   'suball'   'string'  {'on' 'off'}     'off';                   'diffall'  'string'  {'on' 'off'}     'off';                   'std'      'string'  {'on' 'off' 'none'}     'none';                   'diffonly' 'string'  {'on' 'off' 'none'}     'none';                   'allerps'  'string'  {'on' 'off' 'none'}     'none';                   'lowpass'  'float'    [0 Inf]         [];                   'tlim'     'float'    []              [];                   'ylim'     'float'    []              [];                   'tplotopt' 'cell'     []              {};                   'mode'     'string'  {'ave' 'rms'}    'ave';                   'multcmp'  'integer'  [0 Inf]         [] });if isstr(g), error(g); end;figure;try, icadefs; set(gcf, 'color', BACKCOLOR); axis off; catch, end;% backward compatibility of param% -------------------------------if ~strcmpi(g.diffonly, 'none')    if strcmpi(g.diffonly, 'off'), g.addavg = 'on'; g.subavg = 'on'; end;end;if ~strcmpi(g.allerps, 'none')    if isempty(datsub)         g.addall  = g.allerps;    else g.diffall = g.allerps;    end;end;if ~strcmpi(g.std, 'none')    if isempty(datsub)         g.addstd  = g.std;    else g.diffstd = g.std;    end;end;% check consistency% -----------------if length(datsub) > 0 & length(datadd) ~= length(datsub)    error('The number of component to subtract must be the same as the number of components to add');end;regions = {};pnts   = ALLEEG(datadd(1)).pnts;

⌨️ 快捷键说明

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