No BSD License  

Highlights from
DepSubFun

2.66667

2.7 | 3 ratings Rate this file 1 Download (last 30 days) File Size: 2.19 KB File ID: #7434
image thumbnail

DepSubFun

by Michael Robbins

 

13 Apr 2005 (Updated 08 Sep 2005)

Locate dependent sub-functions of m-files.

| Watch this File

File Information
Description

function funnames = DepSubFun(CS,ExcludeRoot);

DEPSUBFUN Locate dependent functions of an M-file.But, unlike DEPFUN, it will look *inside* m-files for *subfunctiosn* and the ability to excludes files that are in the MATLAB root (default).

The intent of finding the subfunctions is to prevent repetition and to identify which functions need to be updated so if you fix one copy, then you will know there are other copies out there that need to be fixed.

The intent of excluding files in the MATLAB root is to find which files must be included in a distribution so they may be uploaded to the MATLAB File Exchange.

INPUTS:
CS, a cellstring of file names (the files you want analysed)

ExcludeRoot, 0 if you want all function names, 1 if you only want the ones not in the MATLAB root.

OUTPUTS
funnames, a cellstring of functions and subfunctions

USAGE
>>d=dir('*.m');
>> DepSubFun({d.name})

See DEPFUN

Keyworkds depfun, dependent, function, subfunction, name

It's not fancy, but it works

Acknowledgements
This submission has inspired the following:
exportToZip: Identifies the dependencies of an M-file and creates a ZIP file
MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
26 Oct 2005 Terry Eldridge

I like it; it's also necessary to get GetSubFunNames.m.

05 Jan 2006 Robert Oostenveld

The function depends on a subfunction that is not included in the fileexchange release.

??? Undefined command/function 'GetSubFunNames'.

Error in ==> DepSubFun at 72
                foo = GetSubFunNames(FID);

11 Apr 2006 Malcolm Wood

If your code uses MATLAB objects, this function returns only the method name, and not the class name, which is unhelpful. Similarly, if you have two sub-functions of the same name in different files, you can't tell which one is being used. Excluding files inside the MATLAB installation is a nice feature, but not for the reasons given: there's no point in identifying sub-functions when looking for dependent *files*. And there are a lot of "fopen" calls without any "fclose" calls, which leaves thousands of open file handles after a few test-runs. And the fact that the function only accepts cell arrays, and not strings, is pretty annoying.

Please login to add a comment or rating.
Updates
18 Apr 2005

% REVISION HISTORY
% Version 1.00
% 4/13/05 [/] Created
% 4/14/05 [/] Nested for loop variable name changed

08 Sep 2005

?

Tag Activity for this File
Tag Applied By Date/Time
path Michael Robbins 22 Oct 2008 07:45:44
dependent Michael Robbins 22 Oct 2008 07:45:45
files Michael Robbins 22 Oct 2008 07:45:45
depfun Michael Robbins 22 Oct 2008 07:45:45
directories Michael Robbins 22 Oct 2008 07:45:45
function Michael Robbins 22 Oct 2008 07:45:45
subfunction Michael Robbins 22 Oct 2008 07:45:45
name Michael Robbins 22 Oct 2008 07:45:45

Contact us at files@mathworks.com