The question says it all, but here it is again. How can I get the function handle to the currently running function without relying upon the current path settings?
fxn = @myFunction;
doesn't work because myFunction is shadowed by a myFunction function which isn't the current function, so fxn is a handle to the wrong myFunction.
fxn = str2func(mfilename());
fails for the same reason.
fxn = str2func(mfilename('fullpath'));
is not a valid way to call str2func.
P.S. - For the curious, I'm trying to run a unit test on a recursive function. To create mockup functions, I have a special path full of mockup functions which is added to the path after I get the function handle to the function which I'm testing. This allows functions within the function being tested to be replaced with mockups that simplify testing. However, this behavior with a recursive function actually prevents the test from being very useful.