开发者

Matlab: Is there a way to get the path of the current script? [duplicate]

开发者 https://www.devze.com 2023-03-07 11:58 出处:网络
This question already has answers here: 开发者_如何学JAVA Closed 11 years ago. Possible Duplicate:
This question already has answers here: 开发者_如何学JAVA Closed 11 years ago.

Possible Duplicate:

Find location of current m-file in Matlab

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


mfilename

Description

mfilename returns a string containing the file name of the most recently invoked function. When called from within the file, it returns the name of that file. This allows a 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 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 string.

0

精彩评论

暂无评论...
验证码 换一张
取 消