Get Dependent Files

버전 1.0.0.0 (4.61 KB) 작성자: Mark Brown
This function returns a list of dependent files called by scripts, functions, and classDef files.
다운로드 수: 615
업데이트 날짜: 2013/9/4

라이선스 보기

This function will analyze an input file for all dependent functions. It works with scripts, functions, and classDef files. It also can return any calls to external functions, toolboxes, built-in functions, Java functions, and other unknown functions. The function was developed specifically to handle large object-oriented projects with many class definitions, packages, and associated functions.

Included are methods to find all of the parent functions that call a listed function (or class). It can optionally return a sparse matrix indicating who calls whom.

Finally, a method is provided to find all of the orphans of a folder or class package that are not called by anyone -- so called "orphans".

For use with classes, this function must be called from the parent directory of any package folders, and other folders containing potential files of interest must be on the Matlab path.

Example usage:
% Constructor
D = getDependents('Main.m');

% Return list of all dependent files
w = D.dependentFiles

% Return direct calls made by ProgramManager.m
x = D.whoAreCalledBy('+myPkg\ProgramManager.m')

% Return files that directly call Job.m
y = D.whoCall('+myPkg\Job.m')

% Return orphans in (or below) the +myPkg package
z = D.findOrp('+myPkg')

% Return orphans in (or below) the \utilities folder
z = D.findOrp('utilities')

% List external, toolbox, builtin, Java, and unknown calls
[ex,tb,bi,ja,un] = D.parseCalls('javaProgram.m')

This function will recursively analyze any external functions called by the input rootFile. It does not recursively search toolbox functions, built-in functions, Java functions, or other unknown functions. It does not list other functions or methods within the same input rootFile.

getDependents.m uses undocumented features of Matlab (mtree, mtfind) which may not be available in future releases. Tested successfully with R2010a, R2011a, R2012a, and R2013a.

인용 양식

Mark Brown (2024). Get Dependent Files (https://www.mathworks.com/matlabcentral/fileexchange/43370-get-dependent-files), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2010a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Search Path에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0