File Exchange

image thumbnail

Recursively get file-dependencies of a given function

version 1.0 (2.55 KB) by

This function searches recursively for all files dependent to a given function (excluding matlabroo

8 Ratings



View License

getFileDependencies('funcName') recursively calls the MATLAB-function 'depfun' to find the files dependent to the given function. It filters out all dependendies on files from matlabroot.

The function returns a filename-list as cell-Array that can be used for example in setting up a job in the Distributed Computing Toolbox:
set(job, 'fileDependencies', getFileDependencies('myFunc'));

Comments and Ratings (9)

David Young

David Young (view profile)

I'm having difficulty seeing what advantage this gives me over calling depfun and then deleting the files in matlabroot from the result. depfun is already recursive, and it looks like you disable this feature then replace it with your own code to traverse the dependency tree. I'm wondering if I've missed something and whether there is some non-apparent advantage?

Really useful piece of code, seems to work perfectly


Dmitry (view profile)

Thomas Vanaret

Thomas Vanaret (view profile)


Jurica (view profile)

Excellent job,

thank you very much :)


Itamar (view profile)


Thanks alot for sharing! Works great for me. Very easy to use and understand.
Simon Robinson, thanks for the tip!

Brent Ware

seems to be broken in 2009b...

Simon Robinson

Simon Robinson (view profile)

Great - does what it says on the packet. Good for preparing MATLAB submissions...
file_list = getFileDependencies(ProgramName);
zip(ArchiveName, file_list);

Ayal Anis

Although haven't tested extensively, it appears to be very useful (especially for unorganized coders...)

MATLAB Release
MATLAB 7.4 (R2007a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today