Home > vbmeg > external > mne > fiff_pick_types.m

fiff_pick_types

PURPOSE ^

SYNOPSIS ^

function [sel] = fiff_pick_types(info,meg,eeg,stim,include,exclude)

DESCRIPTION ^

 [sel] = fiff_pick_types(info,meg,eeg,stim,exclude)

 Create a selector to pick desired channel types from data

 info      - The measurement info
 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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [sel] = fiff_pick_types(info,meg,eeg,stim,include,exclude)
0002 %
0003 % [sel] = fiff_pick_types(info,meg,eeg,stim,exclude)
0004 %
0005 % Create a selector to pick desired channel types from data
0006 %
0007 % info      - The measurement info
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.5  2006/06/29 22:12:28  msh
0022 %   Fixed errors in channel picking
0023 %
0024 %   Revision 1.4  2006/05/03 18:53:04  msh
0025 %   Approaching Matlab 6.5 backward compatibility
0026 %
0027 %   Revision 1.3  2006/04/23 15:29:40  msh
0028 %   Added MGH to the copyright
0029 %
0030 %   Revision 1.2  2006/04/21 11:33:17  msh
0031 %   Added raw segment reading routines
0032 %
0033 %   Revision 1.1  2006/04/20 23:33:20  msh
0034 %   Separated fiff_pick_channels and fiff_pick_types from the _evoked versions
0035 %
0036 %
0037 
0038 me='MNE:fiff_pick_types';
0039 
0040 global FIFF;
0041 if isempty(FIFF)
0042     FIFF = fiff_define_constants();
0043 end
0044 
0045 if nargin == 5
0046     exclude = [];
0047 elseif nargin == 4
0048     include = [];
0049     exclude = [];
0050 elseif nargin == 3
0051     include = [];
0052     exclude = [];
0053     stim    = false;
0054 elseif nargin == 2
0055     include = [];
0056     exclude = [];
0057     stim    = false;
0058     eeg     = false;
0059 elseif nargin ~= 6
0060     error(me,'Incorrect number of arguments');
0061 end
0062 
0063 pick = zeros(1,info.nchan);
0064 
0065 for k = 1:info.nchan
0066     kind = info.chs(k).kind;
0067     if (kind == FIFF.FIFFV_MEG_CH || kind == FIFF.FIFFV_REF_MEG_CH) && meg
0068         pick(k) = true;
0069     elseif kind == FIFF.FIFFV_EEG_CH && eeg
0070         pick(k) = true;
0071     elseif kind == FIFF.FIFFV_STIM_CH && stim
0072         pick(k) = true;
0073     end
0074 end
0075 
0076 p = 0;
0077 for k = 1:info.nchan
0078     if pick(k)
0079         p = p + 1;
0080         myinclude{p} = info.ch_names{k};
0081     end
0082 end
0083 
0084 if ~isempty(include)
0085     for k = 1:length(include)
0086         p = p + 1;
0087         myinclude{p} = include{k};
0088     end
0089 end
0090 
0091 if p == 0
0092     sel = [];
0093 else
0094     sel = fiff_pick_channels(info.ch_names,myinclude,exclude);
0095 end
0096 
0097 return;
0098 
0099 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005