argselectAssign : Assign variables in calling workspace function argselectAssign(variable_value_pairs) Inputs : variable_value_pairs is a cell list of form 'variable1',value1,'variable2',value2,... This function assigns variable1=value1 ... etc in the *callers* workspace 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 argselectCheck Author : David K. Hammond, EPFL LTS2 Date : December, 2007 Project : common utilities
0001 % argselectAssign : Assign variables in calling workspace 0002 % 0003 % function argselectAssign(variable_value_pairs) 0004 % 0005 % Inputs : 0006 % variable_value_pairs is a cell list of form 0007 % 'variable1',value1,'variable2',value2,... 0008 % This function assigns variable1=value1 ... etc in the *callers* workspace 0009 % 0010 % This is used at beginning of function to simulate keyword argument 0011 % passing. Typical usage is 0012 % 0013 % argselectAssign(control_params); 0014 % argselectCheck(control_params,varargin); 0015 % argselectAssign(varargin); 0016 % 0017 % where control_params is a cell list of variable,value pairs containing 0018 % the default parameter values. 0019 % 0020 % See also argselectCheck 0021 % 0022 % Author : David K. Hammond, EPFL LTS2 0023 % Date : December, 2007 0024 % Project : common utilities 0025 0026 % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 0027 % Copyright (C) 2010, David K. Hammond. 0028 % 0029 % The SGWT toolbox is free software: you can redistribute it and/or modify 0030 % it under the terms of the GNU General Public License as published by 0031 % the Free Software Foundation, either version 3 of the License, or 0032 % (at your option) any later version. 0033 % 0034 % The SGWT toolbox is distributed in the hope that it will be useful, 0035 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0036 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0037 % GNU General Public License for more details. 0038 % 0039 % You should have received a copy of the GNU General Public License 0040 % along with the SGWT toolbox. If not, see <http://www.gnu.org/licenses/>. 0041 0042 function argselectAssign(variable_value_pairs) 0043 for j =1:2:length(variable_value_pairs) 0044 pname=variable_value_pairs{j}; 0045 pval=variable_value_pairs{j+1}; 0046 assignin('caller',pname,pval); 0047 end