Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

mfilename

File name of currently running code

Syntax

mfilename
p = mfilename('fullpath')
c = mfilename('class')

Description

mfilename returns a character vector containing the file name of the file in which the function call occurs. When called from within the file, it returns the name of that file. This allows a script or function to determine its name.

p = mfilename('fullpath') returns the full path and name of the file in which the call occurs, not including the filename extension.

c = mfilename('class') in a method, returns the class of the method, not including the leading @ sign. If called from a nonmethod, it yields the empty character vector.

More About

collapse all

Tips

If mfilename is called with any argument other than the above two, it behaves as if it were called with no argument.

When called from the command line, mfilename returns an empty character vector.

To get the names of the callers of a MATLAB® function file, use dbstack with an output argument.

Introduced before R2006a

Was this topic helpful?