getvarg

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

returns if a string is part of varargin and the next parameter


Will be removed (2025-09-21): Use 'getfuncparams' instead


See Also: getfuncparams , getfuncparams

Example Illustration

 missing image of getvarg(argin,paramstr,npnp,P)

Syntax

[f,P]=getvarg(argin,paramstr,[npnp,P])

Input Parameter

argin: varargin
paramstr: searchstring
npnp: number of required arguments, default is 0
P:

Property names

'' :

Output Parameter

f: false/true if the searchstring was found
P: varargins following the searchstring

Examples


getvar(varargin,'verbose')>0




Copyright 2013-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

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).

Input Parameters

Output Results

Algorithm Steps

  1. Initialize f to 0 and P to an empty cell array.
  2. Determine the number of required arguments (np) and default value for P using getfuncparams.
  3. If argin is not empty, iterate through each element:
  4. If np is greater than 0 and there are enough elements, assign the next np elements to P.
  5. If P contains only one element, return it directly instead of as a cell array.
Algorithm explaination created using ChatGPT on 2025-08-19 07:47. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21