Matlab: Is there a way to get the path to the current script?

Possible duplicate:
Find the location of the current m file in Matlab

I have a script that is not in the current directory or in the search path. I want to get the location of a script from a script. Is this possible in Matlab?

+7
source share
1 answer

mfilename

Description

mfilename returns a string containing the file name of the newly called function. When called from within a file, it returns the name of that file. This allows the function to determine its name, even if the file name has been changed.

p = mfilename ('fullpath') returns the full path and name of the file to which the call is made, not including the file extension.

c = mfilename ('class') in the method, returns the class of the method, not including the @ sign. If called from a non-method, it gives an empty string.

+13
source

All Articles