Getting name of the running script from inside the class.

2 次查看(过去 30 天)
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.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Argument Definitions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by