[res] = fiff_pick_types_evoked(orig,meg,eeg,stim,include,exclude) Pick desired channels types from evoked-response data orig - The original data meg - Include MEG channels eeg - Include EEG channels stim - Include stimulus channels include - Additional channels to include (if empty, do not add any) exclude - Channels to exclude (if empty, do not exclude any)
0001 function [res] = fiff_pick_types_evoked(orig,meg,eeg,stim,include,exclude) 0002 % 0003 % [res] = fiff_pick_types_evoked(orig,meg,eeg,stim,include,exclude) 0004 % 0005 % Pick desired channels types from evoked-response data 0006 % 0007 % orig - The original data 0008 % meg - Include MEG channels 0009 % eeg - Include EEG channels 0010 % stim - Include stimulus channels 0011 % include - Additional channels to include (if empty, do not add any) 0012 % exclude - Channels to exclude (if empty, do not exclude any) 0013 % 0014 % 0015 0016 % 0017 % Author : Matti Hamalainen, MGH Martinos Center 0018 % License : BSD 3-clause 0019 % 0020 % 0021 % Revision 1.10 2008/06/12 19:59:19 msh 0022 % Fixed the help text 0023 % 0024 % Revision 1.9 2007/12/23 17:01:24 msh 0025 % Fixed error handling multiple datasets 0026 % 0027 % Revision 1.8 2006/04/26 00:14:24 msh 0028 % Return empty structure from fiff_pick_channels evoked and fiff_pick_types_evoked if there is no match. 0029 % Accuracy checking was incorrect in mne_add_coil_defs 0030 % 0031 % Revision 1.7 2006/04/23 15:29:40 msh 0032 % Added MGH to the copyright 0033 % 0034 % Revision 1.6 2006/04/21 11:33:17 msh 0035 % Added raw segment reading routines 0036 % 0037 % Revision 1.5 2006/04/20 23:33:20 msh 0038 % Separated fiff_pick_channels and fiff_pick_types from the _evoked versions 0039 % 0040 % Revision 1.4 2006/04/17 11:52:15 msh 0041 % Added coil definition stuff 0042 % 0043 % Revision 1.3 2006/04/15 12:21:00 msh 0044 % Several small improvements 0045 % 0046 % Revision 1.2 2006/04/14 15:49:49 msh 0047 % Improved the channel selection code and added ch_names to measurement info. 0048 % 0049 % Revision 1.1 2006/04/14 00:45:42 msh 0050 % Added channel picking and fiff_invert_transform 0051 % 0052 % 0053 0054 me='MNE:fiff_pick_types_evoked'; 0055 0056 if nargin == 5 0057 exclude = []; 0058 elseif nargin == 4 0059 include = []; 0060 exclude = []; 0061 elseif nargin == 3 0062 include = []; 0063 exclude = []; 0064 stim = false; 0065 elseif nargin == 2 0066 include = []; 0067 exclude = []; 0068 stim = false; 0069 eeg = false; 0070 elseif nargin ~= 6 0071 error(me,'Incorrect number of arguments'); 0072 end 0073 0074 sel = fiff_pick_types(orig.info,meg,eeg,stim,include,exclude); 0075 0076 if isempty(sel) 0077 res = []; 0078 fprintf(1,'Warning : No channels match the selection.\n'); 0079 return; 0080 end 0081 0082 res = orig; 0083 res.info.chs = res.info.chs(sel); 0084 res.info.ch_names = res.info.ch_names(sel); 0085 % 0086 % Create the reduced data set 0087 % 0088 for k = 1:length(res.evoked) 0089 res.evoked(k).epochs = res.evoked(k).epochs(sel,:); 0090 end 0091 res.info.nchan = length(sel); 0092 0093 return; 0094 0095 end