Skip to content

mfilename

Name of the currently executing script or function.

str = mfilename
str = mfilename('fullpath')
str = mfilename('class')

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.

disp(['Running ', mfilename])
disp(mfilename('fullpath'))
  • inputname — Variable name of a function argument from the caller’s perspective.