[res] = fiff_pick_channels_evoked(orig,include,exclude) Pick desired channels from evoked-response data orig - The original data include - Channels to include (if empty, include all available) exclude - Channels to exclude (if empty, do not exclude any)
0001 function [res] = fiff_pick_channels_evoked(orig,include,exclude) 0002 % 0003 % [res] = fiff_pick_channels_evoked(orig,include,exclude) 0004 % 0005 % Pick desired channels from evoked-response data 0006 % 0007 % orig - The original data 0008 % include - Channels to include (if empty, include all available) 0009 % exclude - Channels to exclude (if empty, do not exclude any) 0010 % 0011 % 0012 0013 % 0014 % Author : Matti Hamalainen, MGH Martinos Center 0015 % License : BSD 3-clause 0016 % 0017 % 0018 % Revision 1.9 2006/10/04 20:12:37 msh 0019 % Added fiff_read_evoked_all 0020 % Modified fiff_pick_channels_evoked to handle multiple data sets 0021 % Added bad channel writing to fiff_write_evoked 0022 % 0023 % Revision 1.8 2006/06/29 22:12:28 msh 0024 % Fixed errors in channel picking 0025 % 0026 % Revision 1.7 2006/04/26 00:14:24 msh 0027 % Return empty structure from fiff_pick_channels evoked and fiff_pick_types_evoked if there is no match. 0028 % Accuracy checking was incorrect in mne_add_coil_defs 0029 % 0030 % Revision 1.6 2006/04/23 15:29:40 msh 0031 % Added MGH to the copyright 0032 % 0033 % Revision 1.5 2006/04/22 10:59:30 msh 0034 % Added fiff_pick_info 0035 % 0036 % Revision 1.4 2006/04/20 23:33:20 msh 0037 % Separated fiff_pick_channels and fiff_pick_types from the _evoked versions 0038 % 0039 % Revision 1.3 2006/04/18 20:44:46 msh 0040 % Added reading of forward solution. 0041 % Use length instead of size when appropriate 0042 % 0043 % Revision 1.2 2006/04/14 15:49:49 msh 0044 % Improved the channel selection code and added ch_names to measurement info. 0045 % 0046 % Revision 1.1 2006/04/14 00:45:42 msh 0047 % Added channel picking and fiff_invert_transform 0048 % 0049 % 0050 0051 me='MNE:fiff_pick_channels_evoked'; 0052 0053 if nargin == 1 0054 res = orig; 0055 return; 0056 elseif nargin == 2 0057 exclude = []; 0058 elseif nargin ~= 3 0059 error(me,'Incorrect number of arguments'); 0060 end 0061 0062 if isempty(include) && isempty(exclude) 0063 res = orig; 0064 return; 0065 end 0066 0067 sel = fiff_pick_channels(orig.info.ch_names,include,exclude); 0068 if isempty(sel) 0069 res = []; 0070 fprintf(1,'Warning : No channels match the selection.\n'); 0071 return; 0072 end 0073 0074 res = orig; 0075 % 0076 % Modify the measurement info 0077 % 0078 res.info = fiff_pick_info(res.info,sel); 0079 % 0080 % Create the reduced data set 0081 % 0082 for k = 1:length(res.evoked) 0083 res.evoked(k).epochs = res.evoked(k).epochs(sel,:); 0084 end 0085 0086 return; 0087 0088 end 0089 0090 0091