MATLAB: Evalin(‘ca​ller’,’mfi​lename’) does not work.

callerevalinmfilename

function out = cdc
out = evalin('caller','mfilename');
end
This fucntion returns the 'cdc', not the caller's mfilename.

Best Answer

Depending on your release you can get the complete names including the path from dbstack (in v6.5 you couldn't, but already since v7.0 you can). As the doc describes:
dbstack(___, '-completenames')
outputs the fully qualified name of each function in the stack.