Is there a way to search for function calls recursively without running the program?

6 views (last 30 days)
In Visual Studio, the "View Call Hierarchy" option allows you to see everywhere a function is called, where the caller is called, etc., all the way up the hierarchy. This can be done without running the program. Is there a way to do something like this in MATLAB? It seems like you either need to use the "Find Files" feature and manually follow the hierarchy or look at the call stack at run-time.
  2 Comments
Kyle Padilla
Kyle Padilla on 28 Feb 2022
Okay thanks for the advice. I'll see if I can create anything using the references you and Matt provided.

Sign in to comment.

Answers (2)

Steven Lord
Steven Lord on 28 Feb 2022
Static analysis can only get you so far. What function gets called by these two lines of code (omitting the block comment lines) assuming userSpecifiedMatfile contains a MAT-file name?
%{
data = load(userSpecifiedMatfile);
plot(data.x)
%}
Which of the N functions named plot does that second line call?
which -all plot
built-in (/MATLAB/toolbox/matlab/graph2d/plot) /MATLAB/toolbox/matlab/graphfun/@digraph/plot.m % Shadowed digraph method /MATLAB/toolbox/matlab/datatypes/tabular/@tabular/tabular.m % Shadowed tabular method /MATLAB/toolbox/matlab/timeseries/@timeseries/plot.m % Shadowed timeseries method /MATLAB/toolbox/matlab/polyfun/@polyshape/plot.m % Shadowed polyshape method /MATLAB/toolbox/matlab/polyfun/@alphaShape/plot.m % Shadowed alphaShape method /MATLAB/toolbox/matlab/bigdata/@tall/plot.m % Shadowed tall method /MATLAB/toolbox/matlab/graphfun/@graph/plot.m % Shadowed graph method /MATLAB/examples/wavelet/data/@wvtree/plot.m % Shadowed wvtree method /MATLAB/examples/wavelet/data/@edwttree/plot.m % Shadowed edwttree method /MATLAB/examples/wavelet/data/@rwvtree/plot.m % Shadowed rwvtree method /MATLAB/toolbox/bioinfo/bioinfo/@phytree/plot.m % Shadowed phytree method /MATLAB/toolbox/bioinfo/microarray/@HeatMap/plot.m % Shadowed HeatMap method /MATLAB/toolbox/bioinfo/microarray/@clustergram/plot.m % Shadowed clustergram method /MATLAB/toolbox/coder/half/@half/plot.p % Shadowed half method /MATLAB/toolbox/curvefit/curvefit/@cfit/plot.m % Shadowed cfit method /MATLAB/toolbox/curvefit/curvefit/@sfit/plot.m % Shadowed sfit method /MATLAB/toolbox/econ/econ/@conjugateblm/plot.m % Shadowed conjugateblm method /MATLAB/toolbox/econ/econ/@diffuseblm/plot.m % Shadowed diffuseblm method /MATLAB/toolbox/econ/econ/@mixconjugateblm/plot.m % Shadowed mixconjugateblm method /MATLAB/toolbox/econ/econ/@lassoblm/plot.m % Shadowed lassoblm method /MATLAB/toolbox/econ/econ/@mixsemiconjugateblm/plot.m % Shadowed mixsemiconjugateblm method /MATLAB/toolbox/econ/econ/@empiricalblm/plot.m % Shadowed empiricalblm method /MATLAB/toolbox/econ/econ/@blm/plot.m % Shadowed blm method /MATLAB/toolbox/econ/econ/@customblm/plot.m % Shadowed customblm method /MATLAB/toolbox/econ/econ/@semiconjugateblm/plot.m % Shadowed semiconjugateblm method /MATLAB/toolbox/finance/ftseries/@fints/plot.m % Shadowed fints method /MATLAB/toolbox/ident/ident/@iddata/plot.m % Shadowed iddata method /MATLAB/toolbox/ident/nlident/@idnlarx/plot.m % Shadowed idnlarx method /MATLAB/toolbox/ident/nlident/@idnlhw/plot.m % Shadowed idnlhw method /MATLAB/toolbox/mpc/mpc/@mpc/plot.m % Shadowed mpc method /MATLAB/toolbox/robust/rctobsolete/robust/@frd/plot.m % Shadowed frd method /MATLAB/toolbox/robust/robust/@umargin/plot.m % Shadowed umargin method /MATLAB/toolbox/shared/channel/rfprop/@propagationData/plot.m % Shadowed propagationData method /MATLAB/toolbox/shared/drivingscenario/@drivingScenario/plot.m % Shadowed drivingScenario method /MATLAB/toolbox/signal/signal/@dspdata/plot.m % Shadowed dspdata method /MATLAB/toolbox/stats/classreg/@LinearModel/plot.m % Shadowed LinearModel method /MATLAB/toolbox/wavelet/wavelet/@dtree/plot.m % Shadowed dtree method /MATLAB/toolbox/wavelet/wavelet/@wdectree/plot.m % Shadowed wdectree method /MATLAB/toolbox/wavelet/wavelet/@ntree/plot.m % Shadowed ntree method

Matt J
Matt J on 18 Feb 2022
  3 Comments
Kyle Padilla
Kyle Padilla on 28 Feb 2022
It looked to me like the dependecy report focuses more on the files themselves rather than functions within them. Maybe I just don't fully understand the tools.

Sign in to comment.

Categories

Find more on Debugging and Analysis in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by