Determine File Dependencies
Brett's Pick this week is "FDEP: a pedestrian function dependencies finder," by Us.
Back in September, 2009, I featured a file called exportToZip that facilitates easy creation of Zip files. I'm still a fan of Malcolm's submission; I use it frequently.
Today's Pick facilitates the same functionality, plus more. FDEP "dissects [MATLAB] files and iteratively looks for all user-defined functions used during runtime." With a simple syntax:
fd = fdep('MorphTool.m')
you get a structure that shows a wealth of useful information. If you really want to dig in and detect all file dependencies for you MATLAB function, function DEPFUN does a pretty good job--but can be very slow. Us's file is a wrapper around DEPFUN, but "due to an efficient pruning engine," it can be much faster.
Output from depfun is a structure that includes information about Toolbox dependencies, function calls, help, subfunctions, and more. To create a complete zip file, for example, one could say simply:
zip('myZip',fd.fun);
Us's code is, as usual, difficult (for me, at least) to read, but superbly implemented and robust--I've learned to trust it over the years.
As always, comments to this blog post are welcome. Or leave a comment for Us here.
- Category:
- Picks
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.