MATLAB: Evalin(‘caller’,’mfilename’) 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.
Perhaps the variable is in adifferent workspace than where you are trying to use it. For example perhaps you loaded it into the base workspace, but are trying to use it inside a function without passing it in to the function.
Best Answer