thisfuncname
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 4.7, Creation date: 2019-08-01, Last change: 2025-08-18
just returns the name of the calling fnct
Description
very similar to titleofcaller
See Also: titleofcaller
Example Illustration
Syntax
[t,td]=thisfuncname
Output Parameter
t: | | name of calling function |
td: | | |
Examples
thisfuncname
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, thisfuncname, is designed to return the name of the calling function and a timestamp. It is part of the SolidGeometry library and was introduced in version 4.7.
Input Parameters
The function does not take any input parameters.
Output Results
- t: The name of the calling function.
- td: A string combining the name of the calling function and the current date and time.
Algorithm Steps
- Initialize a variable
n to 0. This variable is used to determine the stack level to inspect.
- Use the
dbstack function to get the call stack information and store it in the variable caller.
- Check if the size of
caller is greater than n and n is non-negative.
- If the condition is true, set
fname to the name of the function at the stack level end-n.
- If the condition is false, extract the version of MATLAB using
version and strtok, and set fname to a string indicating the MATLAB version.
- Replace underscores in
fname with hyphens (though this line is commented out in the code).
- Format the output
t using sprintf to include the function name.
- Format the output
td using sprintf to include the function name and the current date and time using datestr(clock).
Algorithm explaination created using ChatGPT on 2025-08-18 22:45. (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