by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CODING/DEVELOP
Introduced first in SolidGeometry 1.0, Creation date: 2013-01-17, Last change: 2025-09-14
Will be removed (2025-09-21): Use 'getfuncparams' instead
See Also: getfuncparams
, getfuncparams
[f,P]=getvarg(argin,paramstr,[npnp,P])
argin: | varargin | |
paramstr: | searchstring | |
npnp: | number of required arguments, default is 0 | |
P: |
f: | false/true if the searchstring was found | |
P: | varargins following the searchstring |
getvar(varargin,'verbose')>0
This function, getvarg, is designed to search through a list of input arguments (argin) for a specific string (paramstr) and return a flag (f) indicating whether the string was found, along with any subsequent arguments (P).
varargin in MATLAB functions.argin.paramstr (npnp), and the second element can specify a default value for P.paramstr in argin. If not found, f is 0.paramstr in argin. If npnp is specified, it returns that many arguments. If only one argument is found, it returns that argument directly.f to 0 and P to an empty cell array.np) and default value for P using getfuncparams.argin is not empty, iterate through each element:paramstr (case-insensitive).f to the current index.P.np is greater than 0 and there are enough elements, assign the next np elements to P.P contains only one element, return it directly instead of as a cell array.