deleteParamsFromVarargin

PURPOSE ^

Utility function to delete parameter keys and values from a varargin input

SYNOPSIS ^

function vars = deleteParamsFromVarargin(paramsToDelete, vars)

DESCRIPTION ^

Utility function to delete parameter keys and values from a varargin input
 Useful when using the same varargin in a base class to initialize a
 derived class
 
 INPUT:
   - paramsToDelete: a cell array with the keys (char arrays) of the
   parameters to delete from the varargin array.
   - varargin
 
 OUTPUT:
   - varargin: filtered varargin array.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vars = deleteParamsFromVarargin(paramsToDelete, vars)
0002 %Utility function to delete parameter keys and values from a varargin input
0003 % Useful when using the same varargin in a base class to initialize a
0004 % derived class
0005 %
0006 % INPUT:
0007 %   - paramsToDelete: a cell array with the keys (char arrays) of the
0008 %   parameters to delete from the varargin array.
0009 %   - varargin
0010 %
0011 % OUTPUT:
0012 %   - varargin: filtered varargin array.
0013 
0014 for i = 1:numel(paramsToDelete)
0015     ind = find(strcmpi(vars, paramsToDelete{i}));
0016     if ~isempty(ind)
0017         vars(ind+1) = []; % The value
0018         vars(ind) = []; % The parameter string
0019     end
0020 end        
0021 
0022 end
0023

Generated on Thu 10-Dec-2020 17:34:27 by m2html © 2005