evalTLvars

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 2.4, Creation date: 2015-07-16, Last change: 2025-09-14

modifies variables of a calling fnct

Description

This programming auxiliary function creates or modifies existing variables in the workspace of the calling function by evaluating a string with default parameter values and an optional second string this is evaulated after the default value string.

See Also: getvarg

Example Illustration

 missing image of evalTLvars (DEFPAR, TLPAR)

Syntax

evalTLvars(DEFPAR,TLPAR)

Input Parameter

DEFPAR: Default variable values
TLPAR: Parameter string (varargins) to overload the default values

Examples

Create variables by a string:
evalTLvars ('a=12, b=13, c=a+b', varargin{1});




Copyright 2015-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 algorithm is designed to modify or create variables in the workspace of the calling procedure by evaluating strings containing default parameter values and optional overriding parameters.

Input Parameters

Algorithm Steps

  1. Concatenate a semicolon to the end of DEFPAR to ensure proper separation of statements.
  2. Concatenate DEFPAR and TLPAR to form a single string that contains both default and overriding parameters.
  3. Split the concatenated string into individual statements using commas and semicolons as delimiters. This results in a cell array of parameter assignments.
  4. Iterate over each element in the cell array:
  5. Remove duplicate parameter assignments by reversing the order of the split strings, applying the unique function with the 'stable' option, and then reversing the order again. This ensures that the last occurrence of each parameter is retained.
  6. Join the unique parameter assignments back into a single string, separated by semicolons, and return this as the modified TLPAR.
Algorithm explaination created using ChatGPT on 2025-08-19 00:02. (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