Code covered by the BSD License  

Highlights from
Publish the main and the subfunctions together

3.33333
3.3 | 3 ratings Rate this file 20 Downloads (last 30 days) File Size: 29.6 KB File ID: #41360 Version: 1.3
image thumbnail

Publish the main and the subfunctions together

by

 

18 Apr 2013 (Updated )

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

| Watch this File

File Information
Description

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>.
Example:
  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')
or
>> 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.

Acknowledgements

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 (3)
07 Jun 2015 Massimiliano Marinucci

I have the same problem as Andres H. It looks like Matlab is busy but memory consumption increases slowly until I have to force to stop.

BTW Would be great if Mathworks could enhance the existing Publish function in some of the next updates to publish subfunctions along with the main function.

Anyway thanks for the effort in trying to enhance this functionality.

01 May 2015 Andres H

I've been trying to output a pdf file, but when I call the function, it just hangs, like it's working. The memory Matlab consumes slowly increases until I force the process to stop.

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:

publish_all_functions('main_sample_function','pdf')

publish_all_functions('main_sample_function','html')

Updates
18 Apr 2013 1.1

Edited the comments and description.

19 Apr 2013 1.3

Added screenshot to the file submission.

Contact us