Getting name of the running script from inside the class.

1 view (last 30 days)
I know that normally you can use mfilename to find the name and address of the file currently running.
I need something a little different: I need the name of the file constructing an instance of the class. I need that filename inside the class body (and of course I want to avoid adding additional argument for passing that filename.)
If I use mfilename inside the class it will obviously return class file which is not useful for me. dbstack seems to be my only option but I don't like it since it seems like the function was not intended for this use case.
Thanks.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!