Code covered by the BSD License  

Highlights from
Publish dependent and called functions

5.0

5.0 | 1 rating Rate this file 5 Downloads (last 30 days) File Size: 4.47 KB File ID: #33476

Publish dependent and called functions

by Nick Angelini

 

26 Oct 2011 (Updated 13 Feb 2012)

Publish explicitly called functions not found in the MATLAB root. See mfile for limitations.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

  publishdepfun creates a single published html file with called
  functions attached to the end of the root mfile. Hyperlinks will be
  within a "Called Functions" in the Table of Contents area of the
  published document that link to the called function. Functions that are
  called that are under MATLABROOT are not included in the published
  output.
 
  publishdepfun only goes one level deep....
  
  Example: If fun1 calls fun2, fun2 will be published. If fun2 calls fun3,
           fun3 will not be published.
 
  Calling: new_doc = publishdepfun(func,opts)
  
  Inputs:
 
  * func => character string of root function or script ('Function1').
            The ".m" is not needed.
  * opts => is the list of options for the publishing. See publish.m help
            for more information.
 
  Outputs:
 
  * new_doc => the final html document with attached subfunctions.
                    Name is the root file name with "_withfuncs" appended.

Required Products MATLAB
MATLAB release MATLAB 7.13 (2011b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
19 Jan 2012 Jiro Doke

Very nice entry Nick!

This may be about preference, but it would be nice if I call the function without any output argument, then it would open the published HTML in the MATLAB browser. This is the same behavior as "publish".

Otherwise, I really like it. I plan on highlighting this entry for this week's Pick of the Week.

Thanks for the submission!

23 Jan 2012 Nick Angelini

@Jiro

I have added some crude support for displaying the html document when no output argument is given. I just used nargout. Is there a more elegant solution?

07 Feb 2012 Mikhail

Thanks!

However, it also includes my called MEX functions into the generated report (which looks kinda weird in the report).

I added the following around line 95 to mitigate this particular behavior:

%% Remove hits that are probably MEX functions
idx=strfind(out,mexext);
for i=1:length(idx),
    idxs(i) = ~isempty(idx{i});
end
out(idxs)=[];

13 Feb 2012 Nick Angelini

Mikhail,

Thanks for finding that. I have added it to the file and have submitted the updated version.

06 Mar 2012 Arvind

Thanks Nick... This is exactly what I needed

19 Mar 2012 Jiro Doke

@Nick,

Thanks for adding the web output in case of no output argument. "nargout" is the appropriate way to deal with that.

Please login to add a comment or rating.
Updates
10 Jan 2012

Version 2
# added ability to pass additional functions as a cell array to be published.
# added '-calltree' opition to the depfun call to find the functions
passed into other functions like ode's and quad.

20 Jan 2012

Changed title

23 Jan 2012

Added support for displaying published html document if no output variable is specified.

23 Jan 2012

Added support for displaying published html document if no output variable is specified.

13 Feb 2012

added ability to remove mex files from output

Tag Activity for this File
Tag Applied By Date/Time
publish Nick Angelini 27 Oct 2011 10:34:58
dependent Nick Angelini 27 Oct 2011 10:34:59
html Nick Angelini 27 Oct 2011 10:34:59
potw Lindsay Coutinho 20 Jan 2012 10:45:46
pick of the week Lindsay Coutinho 20 Jan 2012 10:45:46

Contact us at files@mathworks.com