stringfnctresult
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Text/Strs/Chars/Links
Introduced first in SolidGeometry 4.8, Creation date: 2019-12-07, Last change: 2025-09-14
creates the cell list of output parameters of a batch call
Description
This function supports the collection of results within a batch job workspace
job=SGbatch('clear all; ZZZ=1+1'); wait(job); res=fetchOutputs(job); res{1}
See Also: , SGbatchjob
, SGbatchresult
, SGbatchdelete
Example Illustration
Syntax
[le,re]=stringfnctresult(str)
Input Parameter
str: | | function equation string |
Output Parameter
le: | | list of narout |
re: | | equation |
Examples
stringfnctresult('sqrt(4)')
stringfnctresult('A=sqrt(4)')
stringfnctresult('[A,B,C]=sqrt(4)')
Copyright 2019-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, stringfnctresult, is designed to parse a function equation string and extract the left-hand side (LHS) and right-hand side (RHS) of the equation. It is part of the SolidGeometry library and is used to support batch job result collection.
Input Parameters
- str: A string representing a function equation. This can be a simple function call or an assignment operation.
Output Results
- le: A list of output variable names (LHS of the equation).
- re: The function or expression (RHS of the equation).
Algorithm Steps
- Use
strtok to split the input string str at the '=' character.
- If there is no '=' in the string, set
le to 'ans' and re to the trimmed input string.
- If '=' is present:
- Set
le to the trimmed LHS of the equation.
- Set
re to the trimmed RHS of the equation, excluding the '=' character.
- If
le starts with '[', indicating multiple outputs:
- Trim the brackets and split the string by ',' to get individual output variable names.
- Trim each variable name and store them in
le.
Example Usage
stringfnctresult('sqrt(4)') returns le = 'ans' and re = 'sqrt(4)'.
stringfnctresult('A=sqrt(4)') returns le = 'A' and re = 'sqrt(4)'.
stringfnctresult('[A,B,C]=sqrt(4)') returns le = {'A', 'B', 'C'} and re = 'sqrt(4)'.
Algorithm explaination created using ChatGPT on 2025-08-19 07:04. (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