iscalledbycmdline
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CODING/DEVELOP
Introduced first in SolidGeometry 4.1, Creation date: 2017-08-04, Last change: 2025-08-18
returns wether a fnct was called by commandline directly
Description
This is an auxiliary function for developfunctions such as publishTL to create help text in case that a function is used not in a script or a function but in specific situations
In case of a BATCH process, the function returns false, since the caller is not "Matlab" but "distcomp_evaluate_filetask"
See Also: SGtitle
, verSG
, verOSX
, isatleastVer
Example Illustration
Syntax
b=iscalledbycmdline
Output Parameter
b: | | logical true if length(dbstack) <=2 |
Examples
iscalledbycmdline
Copyright 2017-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, iscalledbycmdline, determines whether it was called directly from the command line or not. It is part of the SolidGeometry library and serves as an auxiliary function for development purposes.
Input Parameters
The function does not take any input parameters.
Output
- b: A logical value that is
true if the function was called directly from the command line, and false otherwise.
Algorithm Steps
- Retrieve the call stack using the
dbstack function and store it in variable a.
- Check the length of the call stack:
- If the length is less than or equal to 2, set
b to true.
- Otherwise, set
b to false.
- If there are no output arguments (
nargout==0), print a message to the command window indicating that the function was called directly from the command line.
Algorithm explaination created using ChatGPT on 2025-08-18 23: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