Get name of functions called inside another function
7 次查看(过去 30 天)
显示 更早的评论
Let's say I have a function defined as :
function output = mainFunction(input1, input2)
a=calledFunction1(input1,input2);
b=calledFunction2(input1);
output= a + b ;
end
Is there a way to get the name of the functions that are called inside the mainFunction ? Such that it would return something like :
calledFunctions(mainFunction)
ans =
calledFunction1
calledFunction2
I did not find any existing function that does it.
0 个评论
采纳的回答
Walter Roberson
2017-11-10
Because function references can constructed from strings at run time, probably the best way is to use the profiler.
There used to be depfun (or was it dfun), which has been replaced by a long command string that is difficult to remember
2 个评论
Walter Roberson
2017-11-10
In a deleted answer, Stephen Cobeldick pointed to https://www.mathworks.com/help/matlab/ref/matlab.codetools.requiredfilesandproducts.html for static analysis (not run-time analysis)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!