📄 pop_select.m
字号:
% pop_select() - remove trials and channels from a dataset%% Usage:% >> OUTEEG = pop_select(INEEG, 'key1', value1, 'key2', value2 ...);%% Graphic interface:% "Time range" - [edit box] time range [low high] in ms. For data epochs,% it is not possible to remove a slice of time (i.e. % either low=0 or high=max time). For continuous data% several intervals can be separated by commas. For % instance "5 10; 12 EEG.xmax" will remove the portion of % data from 0 to 5 seconds and from 10 to 12 seconds.% Command line equivalent: 'time' and 'notime'% "Time range" - [checkbox] by checking the checkbox, the regions% selected will be removed. Command line equivalent: 'time' % [unchecked] and 'notime' [checked]% "Point range" - [edit box] select range in data point instead of ms.% the same remarks as for "Time range" edit box applies.% Command line equivalent: 'point' and 'nopoint'% "Point range" - [checkbox] see "Time range" checkbox. Command line % equivalent: 'point' [unchecked] and 'nopoint' [checked]% "Epoch range" - [edit box] select data epoch indices. This checkbox is% only visible for data epochs. % Command line equivalent: 'trial' and 'notrial'% "Epoch range" - [checkbox] invert epoch selection. Command line% equivalent: 'trial' [unchecked] and 'notrial' [checked]% "Channel rangee" - [edit box] select data channel indices.% Command line equivalent: 'channel' and 'nochannel'% "Channel range" - [checkbox] invert channel selection. Command line% equivalent: 'channel' [unchecked] and 'nochannel' [checked]% "..." - [button] select channels by name.% "Scroll dataset" - [button] call the eegplot function to scroll% channel activities.%% Inputs:% INEEG - input dataset%% Optional inputs% 'time' - time range to include [min max] in seconds. For% data epoch, the range must include either 0 of the max % time, as time regions can not be removed from epochs. For% continuous data, can be [min max] x n to select % several regions. Note that the boundary are both included.% 'notime' - time range to exclude [min max] in seconds. For% continuous data, can be [min max] x n to select % several regions. Note that the boundary are both excluded.% 'point' - data points to include [min max]. For% data epoch, the range must include either 0 of the last % point, as time regions can not be removed from epochs.% For continuous data, can be [min max] x n to select % several regions.% Note that this parameter used to be a point vector. This% format is still functional for downward compatibility.% 'nopoint' - frame vector to exclude in points. If points and% time is set, the point limit values are used.% 'trial' - array of trial numbers to include% 'notrial' - array of trial numbers to exclude% 'channel' - array of channels to include% 'nochannel' - array of channels to exclude% 'newname' - new dataset name%% Outputs:% OUTEEG - output dataset%% Note: the program perform a conjunction (AND) of all optional inputs.% However because negative counterparts of all options are % present, you can theorically perform any logical operation.% % Author: Arnaud Delorme, CNL / Salk Institute, 2001 % % see also: eeglab()%123456789012345678901234567890123456789012345678901234567890123456789012% Copyright (C) 2001 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_select.m,v $% Revision 1.36 2004/03/20 01:30:30 arno% nothing%% Revision 1.35 2003/05/10 17:41:38 arno% fixing scroll dataset time unit%% Revision 1.34 2003/03/19 20:37:24 scott% printf->fprintf%% Revision 1.33 2003/03/07 23:23:02 arno% debuging out of data limits%% Revision 1.32 2003/03/05 18:50:20 arno% adding doc for new button%% Revision 1.31 2003/03/05 18:47:28 arno% [Aadding channel selection window%% Revision 1.30 2003/03/03 22:06:28 arno% debuging single interval selection%% Revision 1.29 2003/02/28 00:57:21 arno% error if time out of range%% Revision 1.28 2003/02/28 00:51:30 arno% milliseconds -> seconds%% Revision 1.27 2003/02/28 00:18:49 arno% backward compatibility%% Revision 1.26 2003/02/28 00:16:14 arno% reprograming data point selection%% Revision 1.25 2003/02/27 20:29:15 arno% same%% Revision 1.24 2003/02/27 20:14:10 arno% debugging last%% Revision 1.23 2003/02/27 03:35:41 arno% graphic interface help%% Revision 1.22 2003/02/27 03:16:02 arno% debugging for continuous dataset (time selection)%% Revision 1.21 2003/01/14 00:28:21 arno% implementing new time selection (using the epoch function)%% Revision 1.20 2002/12/06 03:21:56 arno% correcting typos%% Revision 1.19 2002/10/11 01:22:37 arno% debugging min time when time select%% Revision 1.18 2002/08/21 01:57:57 arno% undo changes%% Revision 1.17 2002/08/21 01:57:16 arno% nothing%% Revision 1.16 2002/08/13 00:08:12 arno% button problem%% Revision 1.15 2002/08/08 02:04:28 arno% changing message order%% Revision 1.14 2002/08/08 01:47:00 arno% editing text%% Revision 1.13 2002/07/29 18:01:41 arno% changing message%% Revision 1.12 2002/07/08 21:42:41 arno% correcting icawinv channel selection bug%% Revision 1.11 2002/06/25 01:55:02 arno% adding parameter check%% Revision 1.10 2002/05/01 01:58:50 arno% removing extra gui parameters%% Revision 1.9 2002/04/30 18:27:11 arno% adding scroll button%% Revision 1.8 2002/04/22 23:43:44 arno% debugging for no latency event structure%% Revision 1.7 2002/04/18 19:16:19 arno% modifying gui%% Revision 1.6 2002/04/11 02:06:24 arno% adding event consistency check%% Revision 1.5 2002/04/09 03:03:26 arno% removing debug message%% Revision 1.4 2002/04/09 01:31:41 arno% debuging event latency recalculation%% Revision 1.3 2002/04/05 23:50:44 arno% typo%% Revision 1.2 2002/04/05 23:28:22 arno% typo corection%% Revision 1.1 2002/04/05 17:32:13 jorn% Initial revision%% 01-25-02 reformated help & license -ad % 01-26-02 changed the format for events and trial conditions -ad% 02-04-02 changed display format and allow for negation of inputs -ad % 02-17-02 removed the event removal -ad % 03-17-02 added channel info subsets selection -ad % 03-21-02 added event latency recalculation -ad function [EEG, com] = pop_select( EEG, varargin);com = '';if nargin < 1 help pop_select; return;end;if isempty(EEG.data) disp('Pop_select error: cannot process empty dataset'); return;end; if nargin < 2 geometry = { [1 1 1] [1 1 0.25 0.23 0.51] [1 1 0.25 0.23 0.51] [1 1 0.25 0.23 0.51] ... [1 1 0.25 0.23 0.51] [1] [1 1 1]}; uilist = { ... { 'Style', 'text', 'string', 'Select data in:', 'fontweight', 'bold' }, ... { 'Style', 'text', 'string', 'Input desired range', 'fontweight', 'bold' }, ... { 'Style', 'text', 'string', 'on->remove these', 'fontweight', 'bold' }, ... { 'Style', 'text', 'string', 'Time range [min max] (s)' }, ... { 'Style', 'edit', 'string', '' }, ... { }, { 'Style', 'checkbox', 'string', ' ' },{ }, ... ... { 'Style', 'text', 'string', 'Point range (ex: [1 10])' }, ... { 'Style', 'edit', 'string', '' }, ... { }, { 'Style', 'checkbox', 'string', ' ' },{ }, ... ... { 'Style', 'text', 'string', 'Epoch range (ex: 3:2:10)' }, ... { 'Style', 'edit', 'string', '' }, ... { }, { 'Style', 'checkbox', 'string', ' ' },{ }, ... ... { 'Style', 'text', 'string', 'Channel range' }, ... { 'Style', 'edit', 'string', '', 'tag', 'chans' }, ... { }, { 'Style', 'checkbox', 'string', ' ' }, ... { 'style', 'pushbutton', 'string', '...', ... 'callback', 'set(findobj(gcbf, ''tag'', ''chans''), ''string'', int2str(pop_chansel(EEG.chanlocs)));' }, ... { }, { }, { 'Style', 'pushbutton', 'string', 'Scroll dataset', 'callback', ... 'eegplot(EEG.data, ''srate'', EEG.srate, ''winlength'', 5, ''limits'', [EEG.xmin EEG.xmax]*1000, ''position'', [100 300 800 500], ''xgrid'', ''off'', ''eloc_file'', EEG.chanlocs);' } {}}; results = inputgui( geometry, uilist, 'pophelp(''pop_select'');', 'Select data -- pop_select()' ); if length(results) == 0, return; end; ... % decode inputs % ------------- args = {}; if ~isempty( results{1} ) if ~results{2}, args = { args{:}, 'time', eval( [ '[' results{1} ']' ] ) }; else args = { args{:}, 'notime', eval( [ '[' results{1} ']' ] ) }; end; end; if ~isempty( results{3} ) if ~results{4}, args = { args{:}, 'point', eval( [ '[' results{3} ']' ] ) }; else args = { args{:}, 'nopoint', eval( [ '[' results{3} ']' ] ) }; end; end; if ~isempty( results{5} ) if ~results{6}, args = { args{:}, 'trial', eval( [ '[' results{5} ']' ] ) }; else args = { args{:}, 'notrial', eval( [ '[' results{5} ']' ] ) }; end; end; if ~isempty( results{7} ) if ~results{8}, args = { args{:}, 'channel', eval( [ '[' results{7} ']' ] ) }; else args = { args{:}, 'nochannel', eval( [ '[' results{7} ']' ] ) }; end; end;else args = varargin;end;% create structureif ~isempty(args) try, g = struct(args{:}); catch, error('Wrong syntax in function arguments'); end;else g = [];end;try, g.time; catch, g.time = []; end;try, g.notime; catch, g.notime = []; end;try, g.trial; catch, g.trial = [1:EEG.trials]; end;try, g.notrial; catch, g.notrial = []; end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -