evalin('caller','mfilename') does not work.
4 次查看(过去 30 天)
显示 更早的评论
function out = cdc
out = evalin('caller','mfilename');
end
This fucntion returns the 'cdc', not the caller's mfilename.
2 个评论
Rik
2019-5-12
Why don't you use mfilename directly in the caller? Alternatively you can do something similar with dbstack.
更多回答(1 个)
Walter Roberson
2019-5-13
"evalin('caller', expression) finds only variables in the caller's workspace; it does not find functions in the caller. For this reason, you cannot use evalin to construct a handle to a function that is defined in the caller."
If I recall correctly mfilename is implemented by defining a function in each file.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Install Products 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!