FUNCTION REFERENCE
mfilename
Name of the running script.
Name of the running script.
Syntax
mfilename()Syntax
mfilename('fullpath')The first form returns the file name without extension; the second includes the folder. It returns an empty text if the script is unsaved.
Example
name = mfilename() % 'myscript' when run from myscript.m; '' at the promptDifferences from MATLAB: Does not change the Current Folder.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.