1 %This file is part of TEAP.
3 %TEAP is free software: you can redistribute it and/or modify
4 %it under the terms of the GNU General Public License as published by
5 %the Free Software Foundation, either version 3 of the License, or
6 %(at your option) any later version.
8 %TEAP is distributed in the hope that it will be useful,
9 %but WITHOUT ANY WARRANTY; without even the implied warranty of
10 %MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 %GNU General Public License
for more details.
13 %You should have received a copy of the GNU General Public License
14 %along with TEAP. If not, see <http://www.gnu.org/licenses/>.
17 %> @brief This
function select a subset of features from
'featuresNames' based on
18 %>
'include' /
'exclude' satements.
19 %> Features are always returned in the same order than
'features name'
21 %> If no Include/exclude statement is specifed all features are returned.
23 %> So far only one include/options option can be specified. If several are
24 %> specified only the last will be taken into account.
26 %> Proposed features which are not included in
'featuresNames' are rejected
32 %> featuresSelector({'A
','B
',C'},
'Exclude',{
'A'})
34 %> @author Guillaume Chanel
36 %> @param featuresNames cell array containing the complete list of features
38 %> @param varargin pair of arguments in the matlab style. The second argument
39 %> represent a subset of features as a cell array. The first
40 %> argument tells
if the subset should be removed from the full
41 %> set of features (
'exclude') or included in an empty set ('include')
43 %> @retval selFeatures a cell array of selected features
46 %If varargin is not specified than all features are computed (default)
48 selfeatures = featuresNames;
50 %Process varargin inputs
51 for(i=1:2:length(varargin))
52 switch(lower(varargin{i}))
54 selfeatures = intersect(featuresNames,varargin{i+1});
56 [~, selfeaturesIndices] = setdiff(featuresNames,varargin{i+1});
57 selfeatures = featuresNames(sort(selfeaturesIndices));
59 error(
'TEAP:badarg',[
'Unkown option: ' varargin{1}])