Code covered by the BSD License  

Highlights from
Publish the main and the subfunctions together

4.0 | 1 rating Rate this file 23 Downloads (last 30 days) File Size: 29.6 KB File ID: #41360
image thumbnail

Publish the main and the subfunctions together



18 Apr 2013 (Updated )

Publishes the main and the subfunctions together into any format as supported by publish command

| Watch this File

File Information

The tool "publish_all_functions" extends the capability of the publish command to publish the main function and its subfunctions together into one document html/pdf/...
Syntax: >>publish_all_functions(<function_name>,options)
- <function_name> - Name of the main function that has to be published.
- Use the same syntax format of "publish" command for <options>.
  1. >> publish_all_functions(<function_name>,'pdf').
  2. >> opts.outputDir = 'C:\';
                 >> opts.format = 'html';
       >>publish_all_functions (<function_name>',opts);
Here are activities done by this utility.
   - Reads all the subfunctions of "<function_name>".
   - Creates a new file with the name "<function_name>", and copies the main function and the all the subfunctions into this.
   - Lists all the "other files" pcodes, mex files and others that are called by <function_name>.m to the user.
   - Publish the new file.
All files are placed in directory publish_files_<date>. If the directory already available, then it overwrites the contents.

Constraint: All functions should use either one of the closing command "return" or "end" uniformly between them. Else the function will stop the publishing process.

Demo: Please download the files.
 Add the “demo_development_folder” into MATLAB path. Browse the contents in the folders. 'main_sample_function' is the main function for this development folder. Call the publishing tool as follows,
>> publish_all_functions('main_sample_function','html')
>> publish_all_functions('main_sample_function','pdf')
It will create a folder “publish_files_<today_date>” with the “html” subfolder. Refer the “html” subfolder for the published files.

Please share your comments and suggestions for any improvements.


Publish Dependent And Called Functions inspired this file.

Required Products MATLAB
MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
20 Feb 2014 Dameon

Dameon (view profile)

This runs perfectly for publishing all functions and nested functions. Only gone about three levels deep but so far.

There is a problem that it crashes MatLab when it tries to publish functions with PLOT's.

Plus a minor detail, the call function commands are a little hard to find in the documentation and are inconsistent in a few places.

After tinkering I found these worked:



18 Apr 2013

Edited the comments and description.

19 Apr 2013

Added screenshot to the file submission.

Contact us