


argselectCheck : Check if control parameters are valid function argselectCheck(control_params,varargin_in) Inputs: control_params and varargin_in are both cell arrays that are lists of pairs 'name1',value1,'name2',value2,... This function checks that every name in varargin_in is one of the names in control_params. It will generate an error if not, otherwise it will do nothing This is used at beginning of function to simulate keyword argument passing. Typical usage is argselectAssign(control_params); argselectCheck(control_params,varargin); argselectAssign(varargin); where control_params is a cell list of variable,value pairs containing the default parameter values. See also argselectAssign This file is part of BPDQ Toolbox (Basis Pursuit DeQuantizer) Copyright (C) 2009, the BPDQ Team (see the file AUTHORS distributed with this library) (See the notice at the end of the file.)


0001 % argselectCheck : Check if control parameters are valid 0002 % 0003 % function argselectCheck(control_params,varargin_in) 0004 % 0005 % Inputs: 0006 % control_params and varargin_in are both cell arrays 0007 % that are lists of pairs 'name1',value1,'name2',value2,... 0008 % 0009 % This function checks that every name in varargin_in is one of the names 0010 % in control_params. It will generate an error if not, otherwise it will 0011 % do nothing 0012 % 0013 % This is used at beginning of function to simulate keyword argument 0014 % passing. Typical usage is 0015 % 0016 % argselectAssign(control_params); 0017 % argselectCheck(control_params,varargin); 0018 % argselectAssign(varargin); 0019 % 0020 % where control_params is a cell list of variable,value pairs containing 0021 % the default parameter values. 0022 % 0023 % See also argselectAssign 0024 % 0025 % This file is part of BPDQ Toolbox (Basis Pursuit DeQuantizer) 0026 % Copyright (C) 2009, the BPDQ Team (see the file AUTHORS distributed with 0027 % this library) (See the notice at the end of the file.) 0028 0029 function argselectCheck(control_params,varargin_in) 0030 [param_names{1:(length(control_params)/2)}]=control_params{1:2:end}; 0031 % check that passed in control parameters are valid 0032 for j=1:2:length(varargin_in) 0033 if(isempty(strmatch(varargin_in{j},param_names))) 0034 error(['Invalid control parameter : ',varargin_in{j},... 0035 ' Valid options are',sprintf('\n'),... 0036 sprintf('%s \n',param_names{:})]); 0037 end 0038 end 0039 0040 % The BPDQ Toolbox is free software: you can redistribute it and/or modify 0041 % it under the terms of the GNU General Public License as published by 0042 % the Free Software Foundation, either version 3 of the License, or 0043 % (at your option) any later version. 0044 % 0045 % The BPDQ Toolbox is distributed in the hope that it will be useful, 0046 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0047 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0048 % GNU General Public License for more details. 0049 % 0050 % You should have received a copy of the GNU General Public License 0051 % along with The BPDQ Toolbox. If not, see <http://www.gnu.org/licenses/>. 0052