mfilename
Name of the currently executing script or function.
Syntax
Section titled “Syntax”str = mfilenamestr = mfilename('fullpath')str = mfilename('class')Description
Section titled “Description”Returns the name of the script/function file currently being executed. With 'fullpath', returns the full file path. With 'class', returns the class name when called inside a method. Returns empty when called from the command line.
Examples
Section titled “Examples”disp(['Running ', mfilename])disp(mfilename('fullpath'))See also
Section titled “See also”inputname— Variable name of a function argument from the caller’s perspective.