Suppose I have:
+MyPackage/+MySubPackage2/some_function.m
How can I generate the string 'MyPackage.MySubPackage2.some_function'
from within this some_function.m
when it's executing?
mfilename()
,dbstack()
,what()
, etc. all just give'some_function'
meta.package.fromName
requires the string we're after as its input- parsing the full path (
mfilename('fullpath')
) ormeta.package.getAllPackages()
etc. seems to be the only way...
Seems that calling mfilename('class')
in a class
inside a package
gives the right answer, but there's no equivalent for plain functions...
...or is there? Feels like I'm missing something obvious...