Identify Program Dependencies
If you need to know what other functions and scripts your program is dependent upon, use one of the techniques described below.
Simple Display of Program File Dependencies
For a simple display of all program files referenced by a particular function, follow these steps:
functionsto clear all functions from memory (see Note below).
Execute the function you want to check. Note that the function arguments you choose to use in this step are important, because you can get different results when calling the same function with different arguments.
inmemto display all program files that were used when the function ran. If you want to see what MEX-files were used as well, specify an additional output:
[mfiles, mexfiles] = inmem
Detailed Display of Program File Dependencies
For a more detailed display of dependent function information, use the
matlab.codetools.requiredFilesAndProducts function. In addition to
which MathWorks® products a particular function depends on. If you have a function,
myFun, that calls to the
edge function in
the Image Processing Toolbox™:
[fList,pList] = matlab.codetools.requiredFilesAndProducts('myFun.m');
fList = 'C:\work\myFun.m'
The only required program file, is the function file itself,
ans = 'MATLAB' 'Image Processing Toolbox'
myFun.m, requires both MATLAB® and the Image Processing Toolbox.
Dependencies Within a Folder
You can use the Dependency Analyzer to analyze the dependencies between all files within a folder. The Dependency Analyzer can identify these dependencies:
Which files in the folder are required by other files in the folder
If any files in the current folder will fail if you delete a file
If any called files are missing from the current folder
To analyze the dependencies within a folder, open the Dependency Analyzer by going to the Apps tab, and under MATLAB, clicking the Dependency Analyzer icon . Then, click the Open Folder button and select the folder that you want to analyze. The Dependency Analyzer shows the results in the form of a dependency graph.
For more information about how to investigate the dependencies within the folder, see Dependency Analysis for Folders and Files.
To determine which MATLAB code files someone else needs to run a particular file use the